I am trying to do A SIMPLE using react-router ( version ^1.0.3 ) to redirect to another view and I am just getting tired.
import React from
How to do a redirect to another route with react-router?
For example, when a user clicks a link Click to route
react-router will look for /
and you can use Redirect to
and send the user somewhere else like the login route.
From the docs for ReactRouterTraining:
Rendering a
will navigate to a new location. The new location will override the current location in the history stack, like server-side redirects (HTTP 3xx) do.
import { Route, Redirect } from 'react-router'
(
loggedIn ? (
) : (
)
)}/>
to: string, The URL to redirect to.
to: object, A location to redirect to.