
What do you think about React fragments and are you using them in your own projects? Please leave a comment below, I would love to hear from you!Īlso remember to subscribe to my newsletter, to stay tuned on the latest news and posts about modern web development.

#Key on react fragment plus#
So the fact that fragments eliminate the wrapper div which can cause problems with invalid HTML and with styling of the components plus the fact that they are faster and the DOM is less cluttered, I’d say they are worth using.

Usually these elements are wrapped for example inside a div. So what are they and should you start using them? The answer to the latter is YES and the answer for the first question is what this blog post is going to tell you.Īre you new to React? Be sure to read my post 6 Things Every Beginner React Developer Should Know.Īs the React.js docs state, a common pattern in React is for components to return multiple elements. Even though they have been around for a while now, many React developers I have talked to haven’t started to use them yet and the number one reason for this usually is that they have heard of them but haven’t got around to learn about them.

React Fragments were introduced in React 16.2.0.
