A hook for managing state in the URL search parameters.
You will most likely want to use this hook with debounce since each url update triggers a page re render.
You should wrap the component that uses this hook with a Suspense.
Reading search parameters through useSearchParams() without a Suspense boundary will opt the entire page into client-side rendering. This could cause your page to be blank until the client-side JavaScript has loaded. Learn more
Installation
Usage
Basic Usage
const [value, setValue] = useSearchParam("name");
With history replace
const [value, setValue] = useSearchParam("name", { history: "replace", });