pbeshai / use-query-params

React Hook for managing state in URL query parameters with easy serialization.
https://pbeshai.github.io/use-query-params
ISC License
2.16k stars 96 forks source link

Add `use client` directive #273

Open chandlervdw opened 1 year ago

chandlervdw commented 1 year ago
createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component

I'm attempting to use this in a NextJS 13 app using the App Router, which defaults to React Server Components. Thusly, client-side components must be specified. This change would be 100% backwards compatible.

r1chm8 commented 1 year ago

I'm also experiencing the same issue, from what I can see it's not possble to use this package in the nextjs app directory without this change.

arthursimas1 commented 9 months ago

i've opened PR #281 to support Next.js routing system. which adapter are you using?