September 2018
Beginner
156 pages
3h 28m
English
The to prop can be either a string or an object. The object can contain the following properties:
Using these parameters, let's add a <Link> component:
<Link to={{ pathname: '/user', search: '?id=1', hash: '#hash',
state: { isAdmin: true } }}> User</Link>
The preceding code translates to the following:
<a href="/user?id=1#hash">User</a>
The state information is not included in the URL path; however, it's available to the component that gets rendered as a result of a <Route> match:
<Route ...
Read now
Unlock full access