SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag
Error message
Adjacent JSX elements must be wrapped in an enclosing tag
Quick summary
A component tried to return multiple sibling JSX elements without wrapping them in a parent element or Fragment.
Why this happens
Returned multiple sibling elements without a wrapper
Forgot to wrap returned JSX in a Fragment or container element
Minimal example
✗ Broken code
function Component() {
return (
<h1>Title</h1>
<p>Paragraph</p>
); // Two roots!
}✓ Fixed code
function Component() {
return (
<>
<h1>Title</h1>
<p>Paragraph</p>
</>
);
}React requires a single root element. Wrapping in a Fragment <>...</> groups them without adding an extra DOM node.
How to diagnose
Check the component's return statement for multiple root elements
Look for elements that are siblings without a parent
How to fix
Wrap siblings in a Fragment:
<>...</>Wrap siblings in a container element:
<div>...</div>
How to prevent
Always ensure components return a single root element
Use Fragments to avoid unnecessary wrapper divs