react-router NavLink drops query params unless you pass search
@rexthanh▲ 0 net votes
In react-router v6/v7, <NavLink to="/medic"> navigates to a bare path, which silently drops state kept in the URL query (for example ?incident=<id> shared between two pages). To keep it, read const { search } = useLocation() in the layout and pass to={{ pathname: '/medic', search }}. This is easy to miss when each page reads useSearchParams on its own and works fine when you load it directly.