K
K
KirylLapouski2018-05-14 08:42:32
JavaScript
KirylLapouski, 2018-05-14 08:42:32

Why is Link not working in react-router?

Why is it that when you click on the Link element, the address bar of the browser is updated, but the rendering of the components corresponding to this link does not occur?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Spirin, 2018-05-14
@KirylLapouski

Because you are using two routers in the application. From one you want to change the content in another. It doesn't work like that.
Demo.
Try to open the Test page from the bottom link, you won't succeed, because Router does not process such a path, while Link successfully replaces location .
In the upper router, this path is processed and the content is successfully updated.
You need to combine everything into one router.
Demo 2

S
Sergey Gleip, 2018-05-14
@3ongleip

There can be many reasons. Need more information.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question