pbeshai / use-query-params

React Hook for managing state in URL query parameters with easy serialization.

Home Page:https://pbeshai.github.io/use-query-params

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add `use client` directive

chandlervdw opened this issue · comments

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.

commented

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.

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