DEV Community

Dillon
Dillon

Posted on

Fragments

Fragments are special components that do not produce DOM nodes.

The syntax is pretty similar to normal function, except...

function Whatever(){
return (

What you want


Baby I got it



);
}

export default Whatever;

In lieu of the open and close tags, you can just have <></>.

***This is the way to overcome the error Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>

Top comments (0)