Fragments don't render divs, they are a placeholder that renders nothing at all to the DOM, so the only thing rendered is what is returned by the functions etc.
So all these examples, which return a wrapper div with conditional content - does React strip out the empty div automatically?
<></> is a Fragment not a <div></div>, so nothing apart from the content is rendered.
<></>
<div></div>
Ah, OP has updated the post. It used to use <div> in all the examples.
<div>
Ahhh!!! That explains a lot :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Fragments don't render divs, they are a placeholder that renders nothing at all to the DOM, so the only thing rendered is what is returned by the functions etc.
So all these examples, which return a wrapper div with conditional content - does React strip out the empty div automatically?
<></>is a Fragment not a<div></div>, so nothing apart from the content is rendered.Ah, OP has updated the post. It used to use
<div>in all the examples.Ahhh!!! That explains a lot :)