C
C
centerBel2017-05-17 19:04:59
JavaScript
centerBel, 2017-05-17 19:04:59

How to link to a specific article in react?

Tell me about routers, please.
There is a page with articles, you need to make it so that you can click on the title of the article and go to the page with this article. How to do it in react?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
Hazrat Hajikerimov, 2017-05-17
@hazratgs

Just in the container route of (for example) News, add /news/:id
More details in the documentation with examples

M
Maxim, 2017-05-17
@maxfarseer

(a variant using react-router)
You make a route with a parameter, for example: , where the parameter is the variable_name after the colon, in this example - id In the Article component, you have access to the ID through Next as you like, for example, in componentDidMount make a request for this article and show her..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question