Skip to content
← Back to activity

Solution skill

React.FC returns ReactNode since 18.2

Version 2Sign in to save

Complete solution

Shows how to fix react.FC returns ReactNode since 18.2. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Issue resend/resend-node#124 (closed, 5 comments): Upgraded to the latest version of @types/react and a FunctionalComponent no longer returns a ReactElement which resend expects, instead a ReactNode is returned From the @types/react codebase:

Steps

  1. Issue resend/resend-node#124 (closed, 5 comments): Upgraded to the latest version of @types/react and a FunctionalComponent no longer returns a ReactElement which resend expects, instead a ReactNode is returned
  2. From the @types/react codebase:
  3. [jayanratna / vcapretz (maintainers)]: Updating the SDK's React.FC types alone wasn't enough - the underlying @react-email render function needed the matching change too. Typing improvements shipped via PR #401; maintainers asked anyone still seeing this on the latest Resend SDK + React versions to reopen. Community workaround: drop the React.FC annotation and declare the email as a plain JSX function.

When to use

You are seeing this: ``ts interface FunctionComponent[P = {}] { (props: P, context?: any): ReactElement[any, any] | null; propTypes?: WeakValidationMap[P] | undefined; contextTypes?: ValidationMap[any] | undefined; defaultProps?: Partial[P] | undefined; displayName?: string |... Use this skill when you run into "React.FC returns ReactNode since 18.2".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: 18.0.28, 18.2.14. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Asked in gh:resend/resend-node#124 (https://github.com/resend/resend-node/issues/124): React.FC returns ReactNode since 18.2. The issue report: Issue resend/resend-node#124 (closed, 5 comments): Upgraded to the latest version of @types/react and a FunctionalComponent no longer returns a ReactElement which resend expects, instead a ReactNode is returned

From the @types/react codebase:

Version 18.0.28

interface FunctionComponent[P = {}] {
    (props: P, context?: any): ReactElement[any, any] | null;
    propTypes?: WeakValidationMap[P] | undefined;
    contextTypes?: ValidationMap[any] | undefined;
    defaultProps?: Partial[P] | undefined;
    displayName?: string | undefined;
}

Version 18.2.14

interface FunctionComponent[P = {}] { The verified answer: [jayanratna / vcapretz (maintainers)]: Updating the SDK's React.FC types alone wasn't enough  -  the underlying @react-email render function needed the matching change too. Typing improvements shipped via PR #401; maintainers asked anyone still seeing this on the latest Resend SDK + React versions to reopen. Community workaround: drop the React.FC annotation and declare the email as a plain JSX function.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_hmsAEqRz_eRjyfQA7vvC5g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">React.FC returns ReactNode since 18.2 <span>— Vectle</span></a>