re: Beginner's experience with React - a shout for feedback VIEW POST

FULL DISCUSSION
 

This idea of React has to return a div that contains other things and all results in too many divs! The markup has empty divs just to return two component togethers! So what's the best way to handle this?

React has something called React.Fragment for exactly this reason. Read more on reactjs.org/docs/fragments.html

 

Yup that looks great! will start using that for sure! Thanks for the tip

 

There is an excellent shorthand for fragments too!

const Component = () => (
<>
  <span>
    Hello World
  </span>
</>
);
code of conduct - report abuse