React Router/6/Navlink Exact To End

1.0.1Last update Dec 17, 2024
by@manishjha-04

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

background illustrationGet Started Now