Help with Parser Error

Hello All, I am trying to upload this code into the script.js in my website and I am getting an error that says “parsing error adjacenct JSX Element must be wrapped in an enclosing tag” right by line 6. I have been looking and I cannot find anything.

Without looking at the code but knowing the error all too well :sweat_smile: - you can only return/render a single jsx element, so if you need to have more than one adjacent you need to wrap them with a parent element. For example if your component was returning

<p>hi</p>
<p>wow</p>

you’d get that error and should wrap them with an element so that one entire element will be rendered:

<div>
  <p>hi</p>
  <p>wow</p>
</div>

If you have the parent container and there’s still an issue, share the project URL so we can see. If the project is private, you can have the support team take a look by sending the URL and issue you’re seeing in a Glitch Request here: https://help.glitch.com/hc/en-us/requests/new

1 Like

I don’t write jsx, but I noticed, isn’t there a “fake” component to wrap things around?

and yes this is the way

<>
  <p>hi</p>
  <p>wow</p>
</>
1 Like

Yeah you’re totally right and that’s in fact better because if your component was returning, say, two li tags you wouldn’t want to have a div wrapped around them - that’s the reason for <>. Good call out!