In this post, we will see - How To Fix - "Parse Error : Adjacent JSX Elements Must Be Wrapped in An Enclosing Tag".
Uncaught Error: Parse Error: Line xx: Adjacent JSX elements must be wrapped in an enclosing tag
Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag.
Did you want a JSX fragment <>...</>?
Syntax error: Adjacent JSX elements must be wrapped in an enclosing tag
React has to return only one element. If you have to return more than one elements, then put all the tags(child) within another element tag(parent). And then return that parent. There are two things to provide to a component tree - a node (element) or a collection of nodes in React. There are certain ways that you have to take up to handle this error. You can use one or the other from the below solutions based on what version of React you are using.
WRONG CODE
return (
<Component />
<Component />
)
RIGHT CODE
return (
<div id="parent">
<Component />
<Component />
</div>
)
WRONG CODE
return (
<Component />
<Component />
)
RIGHT CODE
return (
\[
<Component />,
<Component />
\]
)
OR
RIGHT CODE
return (
\[
<Component key="0" />,
<Component key="1" />
\]
)
return (
<React.Fragment>
<Component />,
<Component />
</React.Fragment>
);
return (
<>
<Component />,
<Component />
</>
);
Uncaught Error: Parse Error: Line xx: Adjacent JSX elements must be wrapped in an enclosing tag ,Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. ,Did you want a JSX fragment <>...</>? ,Syntax error: Adjacent JSX elements must be wrapped in an enclosing tag ,vue parsing error: adjacent jsx elements must be wrapped in an enclosing tag ,unterminated jsx contents ,parsing error: adjacent jsx elements must be wrapped in an enclosing tag eslint ,react fragment ,expected corresponding jsx closing tag for img ,jsx expressions must have one parent element ,enclosing tag html ,expected corresponding jsx closing tag for <li , , ,parsing error: adjacent jsx elements must be wrapped in an enclosing tag eslint ,jsx expressions must have one parent element means ,unterminated jsx contents ,expected corresponding jsx closing tag for img ,react fragment ,jsx expressions must have one parent element jquery ,react-tag , ,adjacent jsx elements must be wrapped in an enclosing tag ,adjacent jsx elements must be wrapped in an enclosing tag react native ,vue parsing error adjacent jsx elements must be wrapped in an enclosing tag ,eslint parsing error adjacent jsx elements must be wrapped in an enclosing tag ,eslint adjacent jsx elements must be wrapped in an enclosing tag ,adjacent jsx elements must be wrapped in an enclosing tag vue ,adjacent jsx elements must be wrapped in an enclosing tag tr , , ,error parsing error adjacent jsx elements must be wrapped in an enclosing tag ,eslint parsing error adjacent jsx elements must be wrapped in an enclosing tag ,parsing error adjacent jsx elements must be wrapped in an enclosing tag vue ,parsing error adjacent jsx elements must be wrapped in an enclosing tag. did you want a jsx fragment ,vue parsing error adjacent jsx elements must be wrapped in an enclosing tag , , ,Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. ,parsing error adjacent jsx elements must be wrapped in an enclosing tag. did you want a jsx fragment ,parsing error adjacent jsx elements must be wrapped in an enclosing tag vue ,eslint parsing error adjacent jsx elements must be wrapped in an enclosing tag ,error parsing error adjacent jsx elements must be wrapped in an enclosing tag ,Adjacent JSX elements must be wrapped in an enclosing tag ,adjacent jsx elements must be wrapped in an enclosing tag ,adjacent jsx elements must be wrapped in an enclosing tag heuer ,adjacent jsx elements must be wrapped in an enclosing tag jsx ,adjacent jsx elements must be wrapped in an enclosing tag questions ,adjacent jsx elements must be wrapped in an enclosing tag react ,adjacent jsx elements must be wrapped in an enclosing tag react native ,adjacent jsx elements must be wrapped in an enclosing tag tr ,adjacent jsx elements must be wrapped in an enclosing tag vue ,adjacent jsx elements must be wrapped in an enclosing tag. did you want a jsx ,error parsing error adjacent jsx elements must be wrapped in an enclosing tag ,eslint adjacent jsx elements must be wrapped in an enclosing tag ,eslint parsing error adjacent jsx elements must be wrapped in an enclosing tag ,inline babel script adjacent jsx elements must be wrapped in an enclosing tag ,parsing error adjacent jsx elements must be wrapped in an enclosing tag ,parsing error adjacent jsx elements must be wrapped in an enclosing tag eslint ,parsing error adjacent jsx elements must be wrapped in an enclosing tag vue ,react adjacent jsx elements must be wrapped in an enclosing tag ,react native adjacent jsx elements must be wrapped in an enclosing tag ,syntax error adjacent jsx elements must be wrapped in an enclosing tag ,vue adjacent jsx elements must be wrapped in an enclosing tag ,vue parsing error adjacent jsx elements must be wrapped in an enclosing tag