DEV Community

Discussion on: Why the Div in React ?

Collapse
 
indoor_keith profile image
Keith Charles

Hi Aaron! I was a little confused by the post for a while, but I think you meant to put more than one paragraph tag inside your return. As you have it now, this is a valid react component with no compiling errors.

We wrap our jsx elements inside of divs (or fragments which I assume you're going to get into on the next article 😉) when we have more than one element we need to render in a single component. So your thoughts are correct, but it doesn't seem like your code is reflecting the "multiple elements" being rendered in a single component.

Great post otherwise! Awesome lesson for those just jumping into React and JSX! 👍

Collapse
 
aaronsm46722627 profile image
Aaron Smith

Hi Keith,

Thanks for your feedback! You're absolutely right, I was playing around with what might be the simplest way to reflect the error. I've edited the post now to make it reflect the text, along with a few grammar mistakes corrected too.

Kind regards
Aaron