D
D
Daniil2018-06-24 10:51:40
React
Daniil, 2018-06-24 10:51:40

React Router on Twitter, how did they implement it?

Can someone please explain how they implemented react router on twitter using example (1, 2). Each navlink from 1 is marked as active at a certain url, and 2 is a sub-option for example Tweets from 1. But when we select one of these three options (from 2), the active element of the Tweet (from 1) is preserved, but the url changes (their in Twitter implementation). I tried for 1 without exact, yes, for sub-options (from 2) everything works ok and Tweets keeps the active class, but then Tweets will always be active on any click from 1 (it has a url without any /... but just a profile url) , that is, we will choose Followed, Lists, etc. - Tweets will be active, again due to the fact that the url matches the profile url.
cc79841f5fa1.png
I would not mind and example
Thank you for reading.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-06-24
@TchernyavskD

To solve the problem, you can use the isActive property .
Demo.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question