Simple, tiny router for React.
<div className = 'Home'>
<Route path = '/'>
<div>Index /</div>
</Route>
<Route path = '/about'>
About me
</Route>
<Route path = '/user/:user'>
<User />
<Route path = '/user/amy'>
Hi amy!
</Route>
</Route>
</div>
- Parameter support via
props.params
- Simple API for navigating pages
- HTML5 History Support
- No wrapping handlers
- Nesting
npm install react-route
Specify an express-style path. For a list of possibilities check out: https://github.com/pillarjs/path-to-regexp
Any child components will receive a params
property based on the pathname and keys provided.
<p>
Welcome user {this.props.params.user}
</p>
Navigate to path
and re-render the routes.
onclick () {
Route.go('/user/amy');
}
MIT