Last active
August 31, 2018 08:40
-
-
Save jhsu/c6a943ce572d43d63a53fabadbdfb119 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NamesakeLink } from 'react-router-namesake'; | |
const Component = () => ( | |
<div> | |
<NamesakeLink to="home">link to /home </NamesakeLink> | |
<NamesakeLink to="users">link to /users</NamesakeLink> | |
<NamesakeLink to="user" params={{ userid: 123 }}> | |
link to /users/123 | |
</NamesakeLink> | |
</div> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Route } from 'react-router'; | |
import { NamesakeRouter } from 'react-router-namesake'; | |
const App = () => ( | |
<Route render={({ history}) => ( | |
<NamesakeRouter | |
push={history.push} | |
routes={{ | |
home: "/home", | |
users: "/users", | |
user: "/users/:userId" | |
}} | |
> | |
{/* your content */} | |
</NamesakeRouter> | |
)} /> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment