nextjs - 💡(How to fix) Fix Components cannot be passed to Client Componets [6 comments, 5 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#91254Fetched 2026-04-08 00:42:03
View on GitHub
Comments
6
Participants
5
Timeline
18
Reactions
0
Timeline (top)
commented ×6subscribed ×4mentioned ×3labeled ×2

Error Message

  1. The following runtime error will appear:

Code Example

Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.
  <... component={function LinkComponent} href=... color=... children=...>
                 ^^^^^^^^^^^^^^^^^^^^^^^^

---

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025
  Available memory (MB): 7786
  Available CPU cores: 12
Binaries:
  Node: 24.14.0
  npm: 11.11.0
  Yarn: 1.22.22
  pnpm: 10.32.1
Relevant Packages:
  next: 16.1.6 // Latest available version is detected (16.1.6).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/objective-matan-xwg65c?workspaceId=ws_SdhpmS4ockzbcXUsgK1BUK

To Reproduce

  1. Start the application in development (next dev)
  2. The following runtime error will appear:
Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.
  <... component={function LinkComponent} href=... color=... children=...>
                 ^^^^^^^^^^^^^^^^^^^^^^^^

Current vs. Expected behavior

It should be possible to pass components down, for example when using polymorphic components.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025
  Available memory (MB): 7786
  Available CPU cores: 12
Binaries:
  Node: 24.14.0
  npm: 11.11.0
  Yarn: 1.22.22
  pnpm: 10.32.1
Relevant Packages:
  next: 16.1.6 // Latest available version is detected (16.1.6).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Runtime

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

next dev (local), next build (local)

Additional context

No response

extent analysis

Fix Plan

To resolve the issue, we need to use the use client or use server directive in our component to specify where it should be rendered.

Step-by-Step Solution

  1. Identify the component: Locate the LinkComponent in your codebase.

  2. Add the use client directive: At the top of your LinkComponent file, add the following line:

    'use client';

    This tells Next.js to render the component on the client-side.

  3. Alternative: Using use server: If your component is meant to be rendered on the server, use the use server directive instead:

    'use server';

Example Code

Here's an example of what your LinkComponent might look like:

// LinkComponent.jsx
'use client';

import React from 'react';

const LinkComponent = ({ href, color, children }) => {
  return (
    <a href={href} style={{ color: color }}>
      {children}
    </a>
  );
};

export default LinkComponent;

Verification

After applying the fix, restart your development server with next dev and verify that the runtime error no longer appears.

Extra Tips

  • Ensure you understand the implications of rendering components on the client vs. server, as this affects SEO, performance, and security.
  • Review the Next.js documentation for more information on using the use client and use server directives.

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