React Router/6/Navlink Exact To End
This codemod replaces the deprecated exact
prop in NavLink
with the modern end
prop. React Router v6 and beyond use end
to indicate that the path should match exactly, making this a necessary update for compatibility with newer versions.
Before
<NavLink exact to="/example">Example</NavLink>
After
<NavLink end to="/example">Example</NavLink>
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community