S
S
SHUPILOID2019-12-05 23:49:29
React
SHUPILOID, 2019-12-05 23:49:29

How to give parent div class active if Navlink has activeClassName?

I want to give parent div class active if Navlink has activeClassName
5de96d2e975a1985606314.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2019-12-06
@SHUPILOID

compare window.location.pathname with /dialogs/props.id and if the same, then add a class?
well, or something from React hooks, if there is no access to location.pathname, like this
https://reacttraining.com/react-router/core/api/Ho...
https://github.com/ReactTraining /react-router/blob...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question