r/javascript • u/batmansmk • Sep 26 '17
React 16
https://facebook.github.io/react/blog/2017/09/26/react-v16.0.html16
u/Skaryon Sep 26 '17
This sounds great. I never used rollup. Will it always yield smaller bundles as opposed to webpack?
31
u/batmansmk Sep 26 '17
Short answer: No.
TL;DR: webpack has more feature for apps, and rollup more for libs. https://medium.com/webpack/webpack-and-rollup-the-same-but-different-a41ad427058c
3
u/Skaryon Sep 26 '17
Haha I just read the same article. Thanks anyway! That answered my question thoroughly.
1
u/Pesthuf Sep 27 '17
But doesn't Webpack do that too?
In the Webpack 3 announcement, they mentioned
webpack.optimize.ModuleConcatenationPlugin()which supposedly does the same.
111
u/basically_alive Sep 26 '17
I felt a great disturbance in the Force, as if millions of pointless divs cried out in terror and were suddenly silenced.
28
u/MOON_MOON_MOON Sep 26 '17
Still waiting for the
<> </>syntax as a shorthand for a list of children without a parent. It's silly to have to providekeyfor every element of a statically known list.11
u/gelezinislokys Sep 26 '17
react-aux
3
u/MOON_MOON_MOON Sep 27 '17
Oh neat, gonna use this for personal projects and continue to spam
<span>s all over the place at work.-13
22
u/Phydos Sep 26 '17
Glad they finally addressed those darn SVG attributes.. The smaller filesize is also a nice bonus
22
u/acyrial Sep 26 '17
MIT license! That's big. I wonder what about all products that were about to be rewritten into non-React solutions due to license.
1
u/PM_YOUR_WORST_FEAR Sep 27 '17
I'm sick to death of the patents license getting brought up in every discussion about frameworks.
27
u/coldlestat Sep 26 '17
Yes! And everything wrapped in a nicer licence :)
29
Sep 26 '17
And by nicer they mean "Your company can use this again without your legal dept lighting your project on fire"
-8
u/fogbasket Sep 26 '17
Until FB sues you for infringing their patents.
12
u/DanielFGray Sep 27 '17
Your risk of being sued by FB is no different from using React or not, even before or after the new license.
5
u/ECrispy Sep 26 '17
Without a patent grant that's debatable.
5
u/Jestar342 Sep 26 '17
IANAL: Does there need to be one? What's the default when grant absentia?
1
u/ECrispy Sep 26 '17
There is no default grant.
1
u/Jestar342 Sep 26 '17
No, I'm not asking if there is a default grant, I am asking what is the default legal position in the absence of a grant.
3
u/ECrispy Sep 26 '17 edited Sep 26 '17
It means you can be sued for patent violation if FB so chooses, since they don't grant you any rights.
Its for this reason that GraphQL, which does have explicit patents, was on such shaky ground - https://www.theregister.co.uk/2017/09/20/gitlab_suspends_graphql_project_over_facebook_license_terms/
FB today announced this - https://code.facebook.com/posts/121714468491809/relicensing-the-graphql-specification/
which seems to have taken care of that issue.
9
u/tonechild Sep 26 '17
Anyone know if this works with enzyme?
10
5
1
u/drom296 Sep 27 '17
so far: upgrading hasn't been smooth.
Upgrading to enzyme@3, requires a new adaptor system. Upgrading to react@16, breaks some other dependencies.
Of course, I'm doing this on a [email protected] project
1
u/tobegiannis Sep 27 '17
Just played around with an upgrade for a few mins. Seems like a pretty clunky way to get enzyme up an running. Do they expect me to import the adapter on every test file or have some kind of useless wrapper?
0
Sep 27 '17
[deleted]
1
1
u/tobegiannis Sep 27 '17
Thanks I am not using cra but I stumbled upon a jest config for test startup scripts and got it working.
1
u/toffeescaf Sep 27 '17
Upgrading for me has been a breeze and I'm working on a fairly large project, any specific things you're running into that are a problem?
1
u/drom296 Sep 28 '17
Thanks for the assist. I'll give it another go tomorrow, and PM you if I run into issues again (if that's alright with you)
1
6
5
3
5
2
u/sickcodebruh420 Sep 27 '17 edited Sep 27 '17
Excited to give this a shot. Any TS users fire it up yet? How are the defs looking?
UPDATE: Defs are good! I got some warnings that were easy to clear up. Some libraries need updates. Normal stuff. Build seems faster.
3
1
-3
-1
-38
u/fogbasket Sep 26 '17
I'll be that guy. AureliaJS is still better in every way. And you could drop React into it if you wanted to sully it.
11
2
u/RuthBaderBelieveIt Sep 27 '17
Except ease of hiring devs or finding work.
1
u/fogbasket Sep 27 '17
If you know one framework you can pick up any of them.
1
u/RuthBaderBelieveIt Sep 28 '17
No doubt, but recruiters don't understand that.
1
u/fogbasket Sep 28 '17
I've had the pleasure of speaking with a few that did but you're right. Most recruiters and hiring managers don't understand.
6
Sep 27 '17
[removed] — view removed comment
5
u/gaearon Sep 27 '17
Hydration = your server gave HTML, and we want to boot up a client up "from" that HTML (and attach events to it) instead of destroying it and rendering from scratch.
3
3
u/learn_to_model Sep 27 '17 edited Sep 27 '17
Hydration is usually referred to as the process of passing
singingdata from the server to the client. In this case the server serves the HTML to the client and react can take over the HTML without destroying and recreating it like it was done in the beginning. Hydration can also refer to models bring updated on load with data that has been passed from the server (think of a redux store f.ex.)3
u/jbkly Sep 27 '17
"passing singing"?
3
2
u/learn_to_model Sep 27 '17
Oh shoot, that's my fault. Shouldn't post comments just after I've woken up. What I meant was the process of passing/sending data from the server to the client.
83
u/batmansmk Sep 26 '17
It's an impressive release. Here is the gist: Among the changes are some long-standing feature requests, including:
fragments,
error boundaries,
portals,
support for custom DOM attributes,
improved server-side rendering,
reduced file size
MIT license,
Fiber