4 ms·
I'm guessing it's because JSX is XML-like and so parsers may require a single root element for each JSX "document". It's a good question though, hopefully someo
by electric_sheep 9y ago
I'm guessing it's because JSX is XML-like and so parsers may require a single root element for each JSX "document". It's a good question though, hopefully someone from the React team might be able to comment.
- danabramov 9y agoBecause it is ambiguous. :-) https://news.ycombinator.com/item?id=15808311 https://news.ycombinator.com/item?id=15808311 If you have a specific proposal for how it should work, I'm happy to look at it and try to poke holes in it.
- electric_sheep 9y agoIt would be, wouldn't it. Silly I didn't realize that right off the bat. Can't imagine putting forward a proposal that wouldn't in essence be what you're doing, i.e. wrapping in JSX delimiters. Because attempting anything fancier than that would probably have edge cases for days, plenty of material for you to poke holes in.