Skip to content
Discussion options

You must be logged in to vote

TL;DR: The 'nuqs/server' import is only useful when using Next.js app router, in all other cases you can import straight from 'nuqs'.

The main difference between the two imports is the presence of the "use client" directive in 'nuqs', which is not present in 'nuqs/server'.

In the Next.js app router (which is currently the only framework that cares about the distinction), shared code (like search params definitions, and creating loaders and serializers) can be done importing from 'nuqs/server', so the code can be bundled in either client or server bundles. The only imports needing the "use client" directive in Next.js app router are the useQueryState(s) hooks.

For any other framework, impo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by devlzcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants