Answer the question
In order to leave comments, you need to log in
How to properly implement url in ReactJS?
How can I work in React with Url for example http://mysite.me/{nickname} - the address of the link to the Account component. The problem is nickname, it changes. Similarly, for example mysite.me/post?id.... url is dynamic.
I implemented the transition to components through React-router, but I set the address in advance.
Nav.jsx
<div className="el_menu">
<Link to="/account" ><h4>Account</h4></Link>
</div>
<Router history={browserHistory}>
<Route path="/" component={Main}>
<IndexRoute component={Home}/>
<Route path="account" component={Account}/>
<Route path="post" component={Post}/>
</Route>
</Router>
Answer the question
In order to leave comments, you need to log in
:nickname - path parameter. Will lie in props. this.props.params.nickname
https://github.com/reactjs/react-router-tutorial/t...
God bless you and read the documentation.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question