nextjs - 💡(How to fix) Fix Compound components are throwing Error: Element type is invalid in next 15.5.5 [3 comments, 4 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#84961Fetched 2026-04-08 02:17:50
View on GitHub
Comments
3
Participants
4
Timeline
7
Reactions
0
Timeline (top)
commented ×3closed ×1issue_type_added ×1labeled ×1

Error Message

Next js throws this error

Code Example

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Home
  Available memory (MB): 12157
  Available CPU cores: 4
Binaries:
  Node: 20.18.0
  npm: 10.9.1
  Yarn: N/A
  pnpm: 9.15.4
Relevant Packages:
  next: 15.5.5 // Latest available version is detected (15.5.5).
  eslint-config-next: 15.5.4
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.2
Next.js Config:
  output: N/A

---

console.log("Tab:", Tabs.Tab);  // undefined

---

console.log("Tab:", Tabs.Tab);  // Tab: [Function: Tab]
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/zpk3k2

To Reproduce

  1. Start the application in development mode

Current vs. Expected behavior

Current Behaviour

Next js throws this error

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Expected Behaviour

Next js should render the compound component

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Home
  Available memory (MB): 12157
  Available CPU cores: 4
Binaries:
  Node: 20.18.0
  npm: 10.9.1
  Yarn: N/A
  pnpm: 9.15.4
Relevant Packages:
  next: 15.5.5 // Latest available version is detected (15.5.5).
  eslint-config-next: 15.5.4
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.2
Next.js Config:
  output: N/A

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

I reproduced this issue in codesandbox and local setup, console logging results in this

page.tsx (Home)

console.log("Tab:", Tabs.Tab);  // undefined

Tabs.tsx

console.log("Tab:", Tabs.Tab);  // Tab: [Function: Tab]

extent analysis

TL;DR

  • The issue is likely due to incorrect import or export of the Tab component from the Tabs file, causing it to be undefined when used in page.tsx.

Guidance

  • Verify that the Tab component is correctly exported from the Tabs.tsx file.
  • Check the import statement in page.tsx to ensure it is importing the Tab component correctly from the Tabs file.
  • Compare the import and export statements in page.tsx and Tabs.tsx to identify any discrepancies.
  • Ensure that there are no circular dependencies or incorrect file paths that could be causing the issue.

Example

// Tabs.tsx
export const Tab = () => { /* component code */ };

// page.tsx
import { Tab } from './Tabs';

Notes

  • The issue may be specific to the development mode or the codesandbox setup, so it's essential to verify the imports and exports in both environments.
  • The provided code snippets and console logs suggest that the issue is related to the import or export of the Tab component, but further investigation may be needed to identify the root cause.

Recommendation

  • Apply workaround: Verify and correct the import and export statements for the Tab component to ensure it is correctly defined and accessible in page.tsx. This should resolve the undefined error and allow the component to render correctly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix Compound components are throwing Error: Element type is invalid in next 15.5.5 [3 comments, 4 participants]