Answer the question
In order to leave comments, you need to log in
React router dom changes link but doesn't rerender component?
I am making a site with movies and there was a problem that the react router dom changes the link in the url, but the component is not redrawn.
There is a main page where popular films / series are shown and another component is drawn on click, at the end of the component, there is a list of similar films on click on which it should redraw the content, but nothing happens.
This is how the component for displaying information about the movie looks like, its url is /detail/id
const Detail = () => {
return (
<DetailInfo />
<Similar />
)
}
const Similar = () => {
return (
<Link to={`/detail/${id}`}>
какие то изображения, по клику на которые, меняется url
</Link>
)
}
Answer the question
In order to leave comments, you need to log in
Here is a banal example https://codesandbox.io/s/divine-field-npv89?file=/...
Look for what is wrong with you.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question