September 2018
Beginner
156 pages
3h 28m
English
The to prop is used to specify the route to which the user should be redirected. If a matching <Route> is found, the user is redirected to the specified path and the corresponding component is rendered.
The to prop can also accept an object that specifies the values for the pathname, search, hash, and state properties:
<Redirect to={{ pathname: '/dashboard', search: '?q=1', hash: '#hash', state: { from: match.url } }} />Similar to the <Link> component, the previously mentioned properties are specified in the to prop of the <Redirect> component. Notice that the state property has the value { from: match.url }. Here, match.url provides the current value of the browser's URL path and this value is then provided to the rendered ...
Read now
Unlock full access