Current parameter passing method:
<Link to={`/topics/${topic.id}`}>{topic.title}</Link>
1. Is the method of passing parameters correct?
Then jump to the next page, the address bar is:
http://localhost:8080/topics/33119
I thought this.props.params.id could get the parameters this way, but it doesn’t seem to work.
2. How to obtain the address bar parameters?
代言2017-06-12 09:34:47
It has been solved. It is still somewhat different from react-router. Question and answer:
1. Routing configuration
<Route path="/topics/:id" component={Topics} />
2. Page before jumping
<Link to={`/topics/${topic.id}`} >点击跳转</Link>
3. Get parameters from page topics after jumping
this.props.match.params.id