r/reactjs • • Sep 26 '17

React v16.0 - React Blog

https://facebook.github.io/react/blog/2017/09/26/react-v16.0.html
219 Upvotes

37 comments sorted by

View all comments

26

u/jarail Sep 26 '17 edited Sep 26 '17

Fragment rendering makes compiling lists/tables/etc so much simpler. I'm glad the new renderer finally made this possible! I'm definitely excited to start using this in a large project!

0

u/[deleted] Sep 26 '17

[deleted]

0

u/[deleted] Sep 27 '17

[deleted]

0

u/[deleted] Sep 27 '17

[deleted]

0

u/[deleted] Sep 27 '17

[deleted]

3

u/GSLint Sep 27 '17

You couldn't do that in React 15. That's exactly what they added in 16.

0

u/[deleted] Sep 27 '17

[deleted]

2

u/[deleted] Sep 27 '17

You can't return arrays in renders. The top-level had to have a single element. React 16 introduces the ability for renders to return arrays.

0

u/[deleted] Sep 27 '17

[deleted]

2

u/[deleted] Sep 27 '17

https://jsfiddle.net/9umwddk3/

Feel free to make that return an array and not throw a console error.

Hint: This will always be the error you get: A valid React element (or null) must be returned. Notice how that doesn't say array? The reason it doesn't is because ALL React components must return React elements. As of React 16, all React components must return a React Element or array of React Elements.

→ More replies (0)