You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// react server componentexportdefaultfunctionPage(){return(<><PageGate/></>)}
Error
Error: 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
Its ok to improve this case as we eventually have to deal with that anyway.
Open questions are only implementation details:
The library is bundled as single file and we don't want to change that, so is it ok to add 'use client' at the top of the whole module?
How it should be implemented with rollup? There could be sourcemap issues if we just add a directive after the build is complete. Is there a rollup plugin for that?
I suggest waiting until the release of react 19 to learn from the experience of other libraries
Proposal
Mark Gate Component with 'use client' directive
Use case
Now we cant do like this
Error
Current solution
The text was updated successfully, but these errors were encountered: