r/reactjs • • Jul 26 '17

React 16 beta | First release of react that ships fiber

https://github.com/facebook/react/issues/10294
179 Upvotes

28 comments sorted by

29

u/PM_ME_HTML_SNIPPETS Jul 26 '17 edited Jul 26 '17

Taken from the page:

What Does React 16 Mean for You?

React 16 is the first release that ships with a rewrite of the React core (previously codenamed "Fiber"). This rewrite had a few goals:

  • Remove old internal abstractions that didn't age well and hindered internal changes.

  • Let us ship some of the most requested features like returning arrays from render, recovering from component errors, and readable component stack traces for every error.

  • Enable us to start experimenting with asynchronous rendering of components for better perceived performance.

This initial React 16.0 release is mostly focused on compatibility with existing apps. It does not enable asynchronous rendering yet. We will introduce an opt-in to the async mode later during React 16.x. We don't expect React 16.0 to make your apps significantly faster or slower, but we'd love to know if you see improvements or regressions.

EDIT: isfiberreadyyet.com

16

u/leom4862 Jul 27 '17

Let us ship some of the most requested features like returning arrays from render

Such a relief! Finally closes #2127

10

u/Not_a_spambot Jul 27 '17

readable component stack traces for every error.

Holy shit you guys I'm so excited

16

u/FoxxMD Jul 27 '17

I am beyond excited for error boundaries.

13

u/terrcin Jul 27 '17

Just swapped it in on a new app I'm developing and worked without an code changes. Nice work everyone involved!

9

u/madcaesar Jul 27 '17

Returning arrays from render and error handling are huge!

2

u/stefan_walker68 Jul 27 '17

Returning arrays from render sounds interesting, any more info?

11

u/[deleted] Jul 27 '17

You don't need to wrap your elements in a parent element when rendering:

return (
    <li>item 1</li>
    <li>item 2</li>
    <li>item 3</li>
)

0

u/[deleted] Jul 27 '17

[deleted]

2

u/[deleted] Jul 28 '17

Yeah. The JSX transpiler itself hasn't changed as far as I know, so that JSX is still invalid, because it would transpile to something like this:

return React.createElement("li", null)React.createElement("li", null)React.createElement("li", null)

That obviously still doesn't make any sense. What they did was made it so when you return an actual array, React can handle that.

2

u/Dualblade20 Jul 27 '17

Cleanse our colons, oh Facebook gods!

3

u/PM_ME_HTML_SNIPPETS Jul 27 '17

Well, colons and useless DOM wrappers.

2

u/lamhocminh Jul 27 '17

For props not use the equal (=)?

1

u/HQxMnbS Jul 27 '17

anyone add this to an ejected create-react-app yet? sorta works, giving me a random warning about some element not being supported by the browser

1

u/PM_ME_HTML_SNIPPETS Jul 28 '17

Not yet. I tried to create a react-scripts version with it, but I can't test for some reason.

When I run the CRA command, it says "cannot find module <path to project>/node_modules/react-scripts/package.json"; if anyone knows how to fix this issue, I could test, otherwise it's there for you to try.

6

u/brianvaughn React core team Jul 26 '17

Ah! Someone beat me to it. :D

0

u/[deleted] Jul 27 '17

Tried to migrate my app. Tons of my plugins still brake 16.0.0 beta 1 sadly.

1

u/Capaj Jul 27 '17

what version were you previously on? They claim if you migrate from 15 you should not have any issues.

4

u/[deleted] Jul 27 '17

3rd party libraries might break regardless of whether your code is ready for the transition.

7

u/PM_ME_HTML_SNIPPETS Jul 27 '17

Yep, says as much in the "Points of Interest" section:

Third party libraries that relied on deprecated or unsupported APIs may need updates to work correctly with this new release. Now is a good time to file issues against libraries that have problems. (And tell us if we broke something!)

0

u/[deleted] Jul 27 '17

I was on react 16.0.0 alpha 11 I think.

1

u/[deleted] Jul 27 '17

Do you remember what the errors said? We have a large application with dozens of plugins and packages, but mostly just prop-types left over on our side that caused errors since React.proptypes doesn't exist any longer. Once that was fixed it ran.

1

u/[deleted] Jul 27 '17

Some of the compile JS is still using react.proptypes and react.create lass

-2

u/newtmitch Jul 27 '17

Man, Node 8 and React 16 - my tech debt outlook is getting more and more interesting. :)

1

u/lamhocminh Jul 27 '17

Why

0

u/newtmitch Jul 27 '17

I just have several things stacking up that I need to get in front of, is all. React 16 is definitely there.

1

u/lamhocminh Jul 28 '17

If you just start you not need worry so much these thing :) even you learn the old react is ok for you learn. I hope you have the good time you learn not so stress. Many programmer the stress

0

u/[deleted] Jul 26 '17

[deleted]

4

u/dcousineau Jul 26 '17

Ahhhh Lin's talks are the best.