Last week I wrote about my favorite change that came with React version 16 – fragment support in components. I had mentioned that there were still annoying things about it, which required workarounds, or ignoring warnings. As if on queue, they put out an update the next day that fixed that! Clearly they read my blog, and care about my priorities. Thanks guys.

They explain the change very well here. Basically, instead of putting everything into brackets as an array with commas between elements, you can now just wrap it all in what appears to be an html tag, indicating it’s a fragment. Basically, syntax is almost exactly like it was before fragments existed, but it’s not an extra div, or whatever you chose to use in the past. They have a few ways to indicate it’s a fragment, but my favorite is simply <> putting things within blank tags, like this </>.

This is really interesting to me, because while I haven’t looked into how exactly they made this work, I’m pretty sure it works about the same way as when they supported arrays – they just abstracted away a lot of the code you need to write to indicate how the fragment should be put together. In any case, I like it a lot. While it’s not anything groundbreaking, it just feels right. It’s the way things should work. So to you React devs at Facebook who definitely read my blog (lol), I am proud of you. Thanks for all you do!