A
A
Alexey Arnaut2021-10-15 14:09:32
React
Alexey Arnaut, 2021-10-15 14:09:32

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 />
  )
}

List of similar films
const Similar = () => {
  return (
   <Link to={`/detail/${id}`}>
     какие то изображения, по клику на которые, меняется url
   </Link>
  )
}

When refreshing the page, everything is redrawn, but there is no
GitHub on click

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Masson, 2021-10-16
@pumbasl

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 question

Ask a Question

731 491 924 answers to any question