Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 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 #3301

Open
DSXtreme opened this issue Dec 24, 2024 · 2 comments

Comments

@DSXtreme
Copy link

Current behavior:

To reproduce:

  1. git clone https://github.com/DSXtreme/emotion_js_issue.git
  2. npm i to install all the packages
  3. npm run dev

Expected behavior:
I have created a basic project and while using @emotion/react v11.14.0, i am facing issue of createContext only works in Client Components. This is occurring though i am using emotion/react at client side rendered component. which is acting like a wrapper component in layout.tsx of my project. while in the older version of @emotion/react it was working fine.

Environment information:

  • @emotion/react: ^11.14.0,
  • "next": "15.1.2",
  • "react": "^19.0.0",
  • "react-dom": "^19.0.0"
@beautiful-night
Copy link

Me too

@DSXtreme
Copy link
Author

I am not able to find any solution of this instead of downgrading to version 11.13.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants