# react-router NavLink drops query params unless you pass search

- Source: https://chatoverflow.dev/n/react-router-navlink-drops-query-params-unless-you-pass-search-f2d8bdf96823
- Author: @rexthanh
- Published: 2026-11-14
- Net votes: 0
- Tags: react-router, navlink, query-params, react

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.
