Live data from Hacker News

React v16.2.0: Improved Support for Fragments

reactjs.org

21–30 of 47 posts

Re: React v16.2.0: Improved Support for Fragments

#21
post #19
post #15

No mention of prior work? This is part of web platform since forever. See document.createDocumentFragment().

We did mention some prior art in the section discussing the new syntax: > Fragment syntax in JSX was inspired by prior art such as the XMLList() constructor in E4X. Using a pair of empty tags is meant to represent the idea it won’t add an actual element to the DOM. You're right that we could have referenced document.createDocumentFragment(), too. Perhaps we'll add that to the documentation. Thanks for the suggestion!

Thanks, it's a useful part of the DOM, perhaps somewhat overlooked.

Re: React v16.2.0: Improved Support for Fragments

#22
post #16

I just can't help but sneer. Opinionated document.write() using "jsx". 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. 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. Enjoy the fragments guys, it will be good practice…

Next time post this kind of stuff on your blog, not HN comments.

Re: React v16.2.0: Improved Support for Fragments

#23
post #20
post #18

Earlier quoted context omitted.

> The Fragment syntax adds some additional magic to JSX (which is rarely a good thing) In: Out: WITCHCRAFT!! SORCERY!! Teasing aside, I don't get what's magical about this. It's a straightforward transform. You can call that "magic," I'll call it "syntax."

Sure, we can call it syntax. Of course, for anyone who already knows what it does, it's just a transform, but the problem with extra syntax is that it makes it harder for newcomers to pick it up. Taking your example when putting it in front of someone seeing it for the first time: In: Out (Newcomer): WTF does that mean? Did someone forget to put something in those tags?

Same newcomer, in a couple of weeks: "Don't know how I lived without it".

I understand your point, but in practice people love tiny affordances like this, especially when they are needed as often as fragments are.

This is a balance, but it's important to consider the needs of power users too. Beginners don't stay beginners forever. We've thought about this for a few months, and decided that adding syntax would be better. I understand some people will always disagree though, and that's fine :-)

Re: React v16.2.0: Improved Support for Fragments

#24
post #16

I just can't help but sneer. Opinionated document.write() using "jsx". 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. 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. Enjoy the fragments guys, it will be good practice…

>back into the arms of Angular

Curious: which one are you referring to?

Re: React v16.2.0: Improved Support for Fragments

#25
post #16

I just can't help but sneer. Opinionated document.write() using "jsx". 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. 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. Enjoy the fragments guys, it will be good practice…

> I had to call a meeting and laid in down in October. If 2018 is React, I am leaving on Dec 31.

I'm not sure they'll miss you.

Re: React v16.2.0: Improved Support for Fragments

#26
post #16

I just can't help but sneer. Opinionated document.write() using "jsx". 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. 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. Enjoy the fragments guys, it will be good practice…

Each to his own.

Kinda weird that it upset you that much.

Re: React v16.2.0: Improved Support for Fragments

#27
post #16

I just can't help but sneer. Opinionated document.write() using "jsx". 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. 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. Enjoy the fragments guys, it will be good practice…

Not to feed a troll but how is doubling down on _Angular_ better for a ”transferable skill set” than React?

Re: React v16.2.0: Improved Support for Fragments

#28
post #18
post #14

I appreciate the addition of Fragments, but I'm not sure if the addition to the JSX syntax was really a good decision. 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 h…

> The Fragment syntax adds some additional magic to JSX (which is rarely a good thing) In: Out: WITCHCRAFT!! SORCERY!! Teasing aside, I don't get what's magical about this. It's a straightforward transform. You can call that "magic," I'll call it "syntax."

Sure it's straightforward enough and much better than what we had before.

But for a newcomer to JSX it looks odd.

I'm probably just missing the reason for the syntax, we're already compiling - why can't fragments be added automatically as required?

Re: React v16.2.0: Improved Support for Fragments

#29
post #16

I just can't help but sneer. Opinionated document.write() using "jsx". 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. 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. Enjoy the fragments guys, it will be good practice…

Next time post this kind of stuff on your blog, not HN comments.

[deleted]

Re: React v16.2.0: Improved Support for Fragments

#30
Ive started with React recently and strangely the lack of fragments were one of the things that caught my attention in the first days.

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 web trinity 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?

Post reply on HN