Skip to content

FunctionComponent cannot return undefined #33908

@sveyret

Description

@sveyret

As an exercise, I am currently transforming some class components into FunctionComponent, using the new hook style. But I faced a strange problem: class components can render undefined (and so, will not display anything), stateless function components can render undefined, but if we need the new FunctionComponent to render nothing, it can only return null, and not undefined (same for RefForwardingComponent).

I think this is a bug, and it will be annoying as my policy (and I know it is the same in many companies) is to avoid usage of null, and prefer undefined.

The correction is trivial, so if you confirm this is an issue, I can make a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions