-
its only been annoying that i have to make the decision of either using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
TL;DR: The The main difference between the two imports is the presence of the 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 For any other framework, importing from either doesn't matter. I tend to import from I'll try and make the docs more clear about this. |
Beta Was this translation helpful? Give feedback.
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 theuseQueryState(s)
hooks.For any other framework, impo…