r/programming • • Sep 26 '17

React v16.0 Released

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

42 comments sorted by

41

u/DoListening Sep 26 '17

Better error handling

...

Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed. Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.

...

In addition to the error message and the JavaScript stack, it also provides component stack traces. Now you can see where exactly in the component tree the failure has happened

Awesome ๐Ÿ™Œ!

2

u/Gavvster Sep 27 '17

The array and string return syntax looks pretty handy as well, will be even better when you donโ€™t have to explicitly set keys for elements in returned arrays.

89

u/HugoWeb Sep 26 '17

Now MIT licensed.

8

u/pure_x01 Sep 27 '17

This is really good and it shows that Facebook cares about the community.

16

u/[deleted] Sep 27 '17

well, it at least shows that they respond to community feedback. At least when they lose their heads and when Wordpress attempts to back out.

But it's still good in the end.

1

u/gavit Sep 27 '17

From what I understand it is worse now...

3

u/mirhagk Sep 27 '17

It's either the same or worse. The community really didn't understand what they were fighting. The patent license never revoked your access to the software, only to the patents. And this MIT version doesn't mention patents at all, which means if they exist they aren't granted.

Of course nobody ever found react patents, and them licensing it as MIT suggests that they never had any so really the situation is unchanged except for the fact that confused developers aren't going to avoid it.

10

u/codekiller Sep 26 '17

The recent license change gave me a change to look at ReactJS+Material UI side-by-side with Vue+Vuetify.js. I have only looked at it for a day or so, but from what I've seen so far, while ReactJS itself is really enjoyable to use (I like how JSX works), Vuetify seems more mature than Material UI. Does anyone have any experience working with both ?

5

u/rebel_cdn Sep 27 '17 edited Sep 27 '17

I haven't worked much with Vuetify, but I've worked with Material UI. If you're looking at a Material Design toolkit for React, you might want to give React Toolbox a try, too.

Most people I've talked to who have tried both have preferred React Toolbox. Last time I tried them both, Toolbox performed better on mobile devices and it was a lot easier to apply custom styling to its components when I needed to do that.

2

u/NeuroXc Sep 27 '17

I prefer using React Toolbox--it's more performant and the API makes more sense, in general--but you need to set up CSS modules for it to work. Depending on a combination of your bundling system and your luck, this might be easy, or it might be very hard. This also means it won't work out of the box with Create React App, and the CRA Readme doesn't include instructions for supporting CSS modules (as far as I'm aware, you have to eject).

Once you get it set up it's nice, but getting it set up is a pain in the ass.

I'm looking forward to the redesign of Material UI, which looks like it will be a huge improvement, but at the moment it's in an alpha state and not all of the components are implemented.

1

u/ThirdEncounter Sep 27 '17

You've got your square brackets and parentheses backwards.

2

u/[deleted] Sep 27 '17

They're a rebel, it's what they do.

1

u/rebel_cdn Sep 27 '17

I, for one, don't welcome our Markdown wielding overlords and so I sometimes put their brackets in the wrong order as my way of fighting back against their oppressive ways.

2

u/rebel_cdn Sep 27 '17

Fixed, thanks.

Even after all these years using Markdown, I still mess that one up sometimes when I'm in a hurry.

1

u/codekiller Sep 27 '17

Thanks, I will take a look at it. I was not necessarily looking for a Material design toolkit, but tried to create the same application with the same look and functionality using React and Vue. Vuetify and Material UI were usually ranking high in the search results so I gave those 2 a shot.

2

u/technojamin Sep 28 '17

Check out the v1 beta for Material UI. They're hosting the documentation here.

16

u/shevegen Sep 26 '17

Biggest news is the licence change.

By the way, don't get me wrong, that was a good move. But there is one thing that confuses me:

  • The Facebook dudes at first gave various reasons why they want to retain the patent clause and why they can not change it. The project Hack for example did not have such a clause.

A bit later, the licence was changed very swiftly. So now ... what about the talk PRIOR to that, that the patent clause was so vital? I mean, if you can change it so quickly, then it can't have been so vital now can it? Plus, I think that it wasn't really that useful to begin with anyway.

18

u/jessta Sep 27 '17

The 'patent grant' was there to indicate that Facebook wouldn't sue you if you used React and React happened to violate a patent that Facebook owned.

Now without the 'patent grant' Facebook can sue you for any patents they own and that React infringes and you can try to defend yourself by claiming that the MIT license implies a patent grant.

So if you weren't intending on suing Facebook then the license changes makes you worse off, but the same amount of worse off as if you were using something like Preact or Vue which people seemed fine with anyway.

7

u/harlows_monkeys Sep 27 '17

Now without the 'patent grant' Facebook can sue you for any patents they own and that React infringes and you can try to defend yourself by claiming that the MIT license implies a patent grant.

Note that there is no explicit copyright license grant in the MIT license, either. All it grants you is "permission to deal in the Software without restriction", and then lists some things that are included in dealing in the software. That list includes things that you need copyright permission to do, and it includes things that you need patent permission to do.

6

u/phantomfive Sep 27 '17

It's worth noting that the MIT license is ambiguous on patents because it was written before software patents existed.

4

u/Shorttail0 Sep 27 '17

I mean, if you can change it so quickly, then it can't have been so vital now can it?

Just corporate bullshitting.

1

u/Tubbers Sep 26 '17

You can't know that unless you are an insider to the discussion. Patents and licenses have been discussed for a loooooong time, maybe enough time has passed and things have changed in the background that allows them to make this change quickly, whereas it would have been slow or impossible in the past. Any assumption one way or the other is pure speculation unless you are privy to the conversation.

-1

u/i_spot_ads Sep 27 '17

ITT: hey guiz licence changed!

-95

u/throwawayco111 Sep 26 '17

Why should I use this over Rust?

40

u/ArguingEnginerd Sep 26 '17

Wait what?

32

u/AngularBeginner Sep 26 '17

It's spam. Ignore it.

-23

u/throwawayco111 Sep 26 '17

You are a beginner. You don't know shit.

-33

u/throwawayco111 Sep 26 '17

2

u/shevegen Sep 26 '17

Damn dude - now you became a spam boot indeed since you link-spam.

4

u/shevegen Sep 26 '17

Do we have Rust in the www already?

1

u/Solon1 Sep 27 '17

Yes, Rust is Web 3.0

1

u/ThirdEncounter Sep 27 '17

May I ask you a question about one of your hobbies?

1

u/djihe Sep 26 '17

Because much less ceremony.

13

u/[deleted] Sep 26 '17

rust is the c++ of rust

0

u/[deleted] Sep 26 '17

[deleted]

2

u/[deleted] Sep 26 '17

i kno rite

-14

u/Theemuts Sep 26 '17

You shouldn't. Any self-respecting programmer would rather compile rust to Javascript than use react.

-6

u/throwawayco111 Sep 26 '17

Thanks. I don't know why you're being downvoted.

-3

u/shevegen Sep 26 '17

I dunno - it seems madness in both ways.

Then again I also think that JavaScript should have never existed in the first place.

-4

u/Theemuts Sep 26 '17

I think people just don't get jokes anymore.

13

u/shevegen Sep 26 '17

Perhaps they get it and think it is not funny!