Skip to content

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

Description

@DSXtreme

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"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions