Skip to content

Compound components cause "React.jsx: type is invalid -- expected a string or a class/function" #74585

Closed
@sebastianvitterso

Description

Link to the code that reproduces this issue

https://github.com/sebastianvitterso/next-compound-component-issues

To Reproduce

Two "ways to break":
First:

  1. Start the app using npm run dev.
  2. Uncomment "use client" in components/Compound/index.tsx.
  3. Broken

Second:

  1. Start the app using npm run dev.
  2. Uncomment EDS' <Table> and <Table.Body>-code in app/page.tsx.
  3. Broken

Video showing:

Screen.Recording.2025-01-07.at.13.48.40.mov

Current vs. Expected behavior

For some reason, compound components "randomly" break when used in conjunction with "use client"-components within server-side pages.
Expectation: No error, just works.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  System Firmware Version: 11881.61.3
Binaries:
  Node: 22.11.0
  npm: 10.9.0
Relevant Packages:
  next: 15.1.1-canary.26
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
  @equinor/eds-core-react: 0.43.0-dev-01062025
Next.js Config: Default

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions