DEV Community

Discussion on: Getting error while rendering component

Collapse
 
fjones profile image
FJones • Edited

You're probably assigning a non-string-or-function to a variable and trying to have that rendered as a component. const Foo = <div />; return <Foo /> or somesuch. That won't work, because it will be transpiled from jsx into something like this: const Foo = jsx("div", ...); return jsx(Foo, ...);, which is invalid.

The error message relates to another common way this happens: getting your import wrong (import Foo vs import { Foo }).