Troubleshooting
Common issues and solutions
Tip
Check out the list of known issues and solutions.
Pages router
Because the Next.js pages router is not available in an SSR context, this
hook will always return null
(or the default value if supplied) on SSR/SSG.
This limitation doesn’t apply to the app router.
Caveats
Different parsers on the same key
Hooks are synced together on a per-key basis, so if you use different parsers on the same key, the last state update will be propagated to all other hooks using that key. It can lead to unexpected states like this:
We recommend you abstract a key/parser pair into a dedicated hook to avoid this, and derive any desired state from the value:
Client components need to be wrapped in a <Suspense>
boundary
You may have encountered the following error message from Next.js:
Components using hooks like useQueryState should be wrapped in <Suspense>
when
rendered within a page component:
The recommended approach is:
- Keep page.tsx as a server component (no
'use client'
directive) - Move client-side features into a separate client file.
- Wrap the client component in a
<Suspense>
boundary.