71
rated 0 times
[
76]
[
5]
/ answers: 1 / hits: 27903
/ 7 Years ago, tue, march 7, 2017, 12:00:00
In short: I want to show the slug instead of the Id in the URL, whats the best way to do that?
In my app.js component I am using React-router this way so far:
<Router history={browserHistory}>
<Route path=/ component={Main}>
<IndexRoute component={Home}></IndexRoute>
<Route path=/profile/:slug component={Split}></Route>
</Route>
</Router>
Then in my profile component I am using Link to go to that specific profile via the slug:
<Link to={'/profile/' + username.slug}>{username}</Link>
I was thinking of keying them together in my profile reducer or something?
Any tips would be very helpful!
More From » reactjs