Skip to content

Add a more helpful message when passing an element to createElement() as a type #13130

@gaearon

Description

@gaearon

This:

createElement(<div />)

doesn't currently give a distinguishable message.

https://stackoverflow.com/questions/51110436/wrapping-provider-in-same-component-throws-element-type-is-invalid-expected-a-s

But we can easily detect it by checking for $$typeof and in that case suggest something more concrete (e.g. "Did you accidentally export JSX instead of a component?").

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions