Is there any way to set active state in active
attribute instead of activeClassName
on React Router NavLink?
For a specific reason, it needs to be in the active state. There is this isActive
function in NavLink that I think might be useful to achieve what I need. But so far I have no result. I was thinking of something like below but it does not work.
What I have tried:
const abc = (match, location) => {
return match;
}
<NavLink to="/faq" isActive={abc} active={props.isActive ? "true" : null}>
FAQs
</NavLink>