1 li tag class can display the style normally using active, but it is not effective to replace the li tag with NavLink.
directly setting the style in NavLink (in the form of figure 2) can only change the class of the a tag (converted to a tag after html) rather than the li tag, so the effect can not be achieved.
I want to change the className in the li tag to active based on the route such as to= "/" address. How can we do that? Css is really a little complicated, directly to change css do not know how to change, is there a method that can be realized in react, or ideas that can be done?
Thank you very much, bosses.