Link
Link
provides declarative, accessible navigation around your application.
<Link to='/user'>user</Link>
Props
- to
- type:
string
|object
- default: null
- example:
/about
..
./edit
{pathname: './courses',search: '?sort=name', hash: '#the-hash', state: { fromDashboard: true }}
- type:
the location to link to, support relative navigation.
- replace
- type:
bool
- default: false
- type:
Whether replace
the current entry in history
instead of adding a new one, which is the default behavior of push
.
- context
- type:
bool
- default: false
- type:
If true
, navigation is based on matched url in inner most Route
holds this Link
.
// Current URL is `/user/123`
<Route path='/user' component='div>
<Link context to='./books'></Link> {/* navigate to `/user/books` */}
<Link to='./books'>Edit</Link> {/* navigate to `/user/123/books` */}
</Route>