Several people had already noted [0] that you could implement equivalent behavior by using a component that simply returns its own children:<p><pre><code> const Fragment = ({children}) => children;
// later
return <Fragment><Component1 /><Component2 /></Fragment>;
</code></pre>
Nice to see this added as both a built-in component type and a useful syntax extension. (Now if they'd just modify JSX syntax so that we can pass props by matching local variable names similar to how ES6 object literals work, like `<SomeComponent a b c />`, rather than having that become a defaulted-true boolean, I'd be happy :) )<p>[0] <a href="https://medium.com/@gajus/using-react-v16-to-create-self-destructing-components-de8e4eb61d0f" rel="nofollow">https://medium.com/@gajus/using-react-v16-to-create-self-des...</a>
Ive started with React recently and strangely the lack of fragments were one of the things that caught my attention in the first days.<p>Another thing I'm looking for in React as I get started is better styling support. I'm resourcing to React JSS for that, but I feel it should be part of the language. The <i>web trinity</i> if you may is HTML-CSS-JS and React basically left CSS out half-baked into almost unusable style attributes, so I still have to resource to className and CSS. Or am I just being noob-anal?
I appreciate the addition of Fragments, but I'm not sure if the addition to the JSX syntax was really a good decision.<p>While it initially took some time to wrap my head around JSX (especially with a lot of JS mixed into it), after that I really started to enjoy JSX for its simplicity. The Fragment syntax adds some additional magic to JSX (which is rarely a good thing), and will also very likely break all the syntax highlighting out there again when used.
Man, although fragments are a pretty useful concept, the implementation is really terrible. It feels so uninspired and without thought of the design, in my opinion. They could have chosen some character instead of an empty tag and it would have been much better, like an asterisk[1], because it would be clear that the tag serves a defined purpose. I would almost argue that if this weird shorthand is necessary to accomplish this task (something that irked me when creating text heavy pages) then JSX should be redesigned to handle it natively without the weird fragment syntax.<p>1: Like this:<p><pre><code> <*> ... </*></code></pre>
I love to see these small improvements added to React.<p>Everything is not perfect though, some issues have been here for a looong time. At the moment, my biggest problem is the non-support of passive events [0]. And today, some browsers are starting to make some events passive by default (`touchmove` on Chrome for example), it is quietly starting to become a serious problem for developers to get things working fine cross-browser without anti-patterns.<p>[0] <a href="https://github.com/facebook/react/issues/6436" rel="nofollow">https://github.com/facebook/react/issues/6436</a>
Why can't they automatically wrap every bit of JSX with a <Fragment> tag? That way users would need to include an empty tag when they're returning multiple elements, and they're not it'll be a fragment tag that just contains a single element.
This is a bit off topic, but does anyone reading this happen to know the status of async rendering in react?<p>There was chatter about it for version 16, and then nothing really else. I'm curious about what they are testing or at least planning in this area.<p>Unfortunately i've found it really hard to search for anything related to async rendering for react, as there is just so much other crap about react and "async" it just gets lost.
I just can't help but sneer. Opinionated document.write() using "jsx".<p>Working with react has been the worst experience of my life. I had to call a meeting and laid in down in October. If 2018 is React, I am leaving on Dec 31.<p>So soon I am going swiftly back into the arms of Angular and I can't wait. Honestly, my eyes are blurring as I type this with pure happiness.<p>Enjoy the fragments guys, it will be good practice for picking up what little is left of your happiness and transferable skill set in years to come.