Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
232 views
in Technique[技术] by (71.8m points)

react router - Nearby links Active class

So I am trying to do this or something similar, and I am running into the same issues. I want to link to a particular place, but light up the link if it is kind of nearby.

what I want to be able to do is something like...

<NavLink to="/one" path={["/one", "/two"]}/>

more concrete example: I want to click on the link to go directly to a recent user, but the link should show that the section is active regardless of which user or any is selected.

<NavLink to="/users/abc123" path={["/users"]}/>

I tried using the isActive prop but this appears to only be called with a match if the to was matched, so it's only good to be more specific, but can't seemingly be used to be less.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...