NavLink in React JS not working as expected?

Discussão em 'Angular' iniciado por Mohit Prajapat, Dezembro 12, 2024.

  1. So, I am working with ReactJS. In Sidebar ) used NavLink but when i am working with nested routes it is not working as expected.

    <li>
    <NavLink
    role="button"
    to="/organization/"
    className="flex flex-row justify-start gap-2 items-center"
    >
    <MdDashboard /> Dashboard
    </NavLink>
    </li>
    <li>
    <NavLink
    role="button"
    to="/organization/customization"
    className="flex flex-row justify-start gap-2 items-center"
    >
    <MdOutlineDeveloperMode /> Customization
    </NavLink>
    </li>


    Nested Route = http://localhost:3000/organization/customization

    It added active class to both /organization & /organization/customization

    [​IMG]

    I Wanted to make sure nested routes works with NavLink.

    Continue reading...

Compartilhe esta Página