News for hackers. Stuff that matters.
Re:React 16 by spicyj on Tuesday September 26, 2017 @12:33PM (#15340210)
We're really excited about this release. I also wrote about how we made the rewrite happen on our Facebook engineering blog: https://news.ycombinator.com/item?id=15339825.

Happy to answer questions if y'all have any. :)

Re:React 16 by sAbakumoff on Tuesday September 26, 2017 @01:02PM (#15340507)
That's truly hard work to rewrite everything from scratch and keep the legacy API untouched! OOC - what was the most difficult feature/bug to preserve/fix in this process?
Re:React 16 by outside1234 on Tuesday September 26, 2017 @12:38PM (#15340276)
Are there plans to relicense React Native to MIT without a Patent timebomb as well?
Re:React 16 by danabramov on Tuesday September 26, 2017 @12:54PM (#15340438)
It's possible in the future, but re-licensing React itself was already a very large change, and it will take more time to review the possibility of this for other projects like RN. Thanks for your patience!
Re:React 16 by moomin on Tuesday September 26, 2017 @01:11PM (#15340594)
Yeah, pity said large change was implemented before checking if it was a good idea.

Community: This license is a legal nightmare. Something needs doing! Facebook: We have done something. Community: Try listening to both sentences next time.

Re:React 16 by rhencke on Tuesday September 26, 2017 @01:25PM (#15340744)
The MIT license is extremely commonplace in web libraries and is well accepted. (used by jQuery, Preact, Angular, etc.)

Can you clarify your concerns?

Re:React 16 by slaymaker1907 on Tuesday September 26, 2017 @01:36PM (#15340856)
I'm not in anyway connected with FB, but I think the reason why React was licensed under MIT more quickly than React Native is because of that licensing environment. Web frameworks traditionally have very open licenses, but native seems more more restricted such as with Qt and the C# thing I don't remember the name of.
Re:React 16 by bennyg on Tuesday September 26, 2017 @01:50PM (#15340983)
Except the largest 3rd party Objective-C and Java (Android) libraries are usually MIT as well. I don't really think this has to do with traditions as far as per platform licensing goes.
Re:React 16 by bernadus_edwin on Tuesday September 26, 2017 @02:46PM (#15341468)
C# things : xamarin & mono
Re:React 16 by mihular on Tuesday September 26, 2017 @01:53PM (#15341009)
But does MIT license really solve all patent issues? FB could still enforce patents regardless of license if I understood it properly.
Re:React 16 by mlsarecmg on Tuesday September 26, 2017 @02:16PM (#15341231)
Everyone can, that's precisely why they gave you a grant previously. Now that it's gone due to the outcry it's in the same, vague playing field that all other libraries are in. Every project you have ever written infringes on someones IP. The only thing that matters is that lawyers that previously got cold feet can now relax. We had a project for instance that was canceled, now it's being green-lit thanks to the MIT license.
Re:React 16 by TimTheTinker on Tuesday September 26, 2017 @02:36PM (#15341409)
Actually, there is an (albeit so far untested) implicit patent grant in all-permissive licenses like the MIT. So removing the explicit one-way, revokable patent grant actually implicitly provides a better patent grant.
Re:React 16 by DannyBee on Sunday October 01, 2017 @04:33PM (#15379645)
This is not untested, only untested in the software field. It's very very very well tested in other fields.

So far, every court ever (and there are quite a lot of them) has said "when you tell people they can use your thing and do what they want with it, you can't sue them later for infringement for doing what you said was okay".

There is pretty much zero precedent on the other side.

In fact, one of the only related pieces of precedent on the other side, which was "attempting to avoid patent exhaustion by contract" was completely and totally overruled by the supreme court last year, where they unequivocably said that sales exhaust patents, no matter what you make a person agree to.

Re:React 16 by mihular on Tuesday September 26, 2017 @03:18PM (#15341693)
I'd really like to see that written black on white,though.
Re:React 16 by DannyBee on Sunday October 01, 2017 @04:34PM (#15379650)
Black and white is not as good as everyone seems to think. There are reasons you don't enumerate every possibility ;) (courts will then interpret that as a complete list, instead of extending it to cover similar situations)

If you had black and white fair use, for example, you'd just be railing against the fact that courts wouldn't extend it to cover new similar thing X.

Black and white is good for establishing baselines in law (IE "these things over here are definitely okay, and everything else should be judged by these factors" It's rarely that great if you are trying to make a license that stands the test of time and march of technology.

Re:React 16 by TimTheTinker on Tuesday September 26, 2017 @07:40PM (#15343635)
The fact that MIT and BSD licensed code (implicit patent impunity) can be re-licensed under the Apache license (explicit patent impunity) is enough evidence for me.

Reference: http://apache.org/legal/resolved.html#category-a

Re:React 16 by ec109685 on Wednesday September 27, 2017 @12:24AM (#15344912)
What does re-licensed mean? You can’t take mit licensed code and slap a Apache License on it.
Re:React 16 by TimTheTinker on Wednesday September 27, 2017 @03:33PM (#15351464)
You can create a derivative work and license that under Apache.
Re:React 16 by ec109685 on Friday October 06, 2017 @01:41AM (#15414663)
Not if it uses copyrighted MIT licensed code.
Re:React 16 by abiox on Tuesday September 26, 2017 @03:34PM (#15341832)
react isn't covered by fb patent, so using react grants nothing in terms of fb patents (implied or otherwise).
Re:React 16 by signal11 on Tuesday September 26, 2017 @02:12PM (#15341178)
IANAL, but is it fair to say that using React under MIT doesn't leave you any worse off than using Angular and Vue? (both of which are MIT-licensed)

Depending on the patent in question, it is possible to be on the hook even if you don't use React.

Re:React 16 by mihular on Tuesday September 26, 2017 @03:18PM (#15341684)
But do the others have explicit patents?
Re:React 16 by pritambaral on Tuesday September 26, 2017 @08:37PM (#15343929)
Does React?
Re:React 16 by mihular on Wednesday September 27, 2017 @02:12AM (#15345290)
I don't know. But Facebook owns around 5200 patents. Add the previous patent clause to it and you have a good probability that there are patents covering parts of react. VirtualDOM is certainly a candidate.
Re:React 16 by Lazare on Tuesday September 26, 2017 @10:03PM (#15344318)
> But does MIT license really solve all patent issues?

Close enough, I'd say.

> FB could still enforce patents regardless of license

It is widely accepted that the MIT license has an implicit patent grant.

Re:React 16 by tomkinson on Tuesday September 26, 2017 @12:50PM (#15340390)
My understanding this was already done last week. I could be wrong. GraphQL however, not yet.
Re:React 16 by vvanders on Tuesday September 26, 2017 @12:52PM (#15340422)
Not React Native, that still has the patent clause.
Re:React 16 by yasserkaddour on Tuesday September 26, 2017 @01:23PM (#15340732)
GraphQL specification has been relicensed minutes ago to Open Web Foundation Agreement, graphql-js and relay to MIT.

https://medium.com/@leeb/relicensing-the-graphql-specificati...

https://news.ycombinator.com/item?id=15340528

Re:React 16 by swah on Tuesday September 26, 2017 @01:35PM (#15340846)
But now they "have" to relicense React Native, right? Otherwise someone will write a React Native clone starting from MIT-licensed React, no?
Re:React 16 by andrewingram on Tuesday September 26, 2017 @07:38PM (#15343630)
I suppose they might, and good luck to them. React Native is a monstrously complex beast in comparison to React.

Ultimately the React ecosystem would benefit from the attempt.

Re:React 16 by Dolores12 on Tuesday September 26, 2017 @12:53PM (#15340433)
[edited]
Re:React 16 by Godel_unicode on Tuesday September 26, 2017 @01:06PM (#15340545)
Here's the problem with that type of snark; when you're wrong it's really bad for you. You are responding to a question about react NATIVE, which still has the patent grenade (see below).

https://github.com/facebook/react-native/blob/master/PATENTS

Re:React 16 by ec109685 on Wednesday September 27, 2017 @12:27AM (#15344925)
What patents does react native utilize of facebook’s?
Re:React 16 by Godel_unicode on Thursday September 28, 2017 @03:27PM (#15360004)
Not sure, but that's not relevant to the patent grenade. It revokes your license if you're involved in ANY patent action against Facebook, regardless of that patent being used in RN or not.
Re:React 16 by ec109685 on Friday October 06, 2017 @01:40AM (#15414657)
It does not revoke your license to use RN if you sue Facebook.
Re:React 16 by seattle_spring on Tuesday September 26, 2017 @12:58PM (#15340474)
React !== React Native
Re:React 16 by ofirg on Tuesday September 26, 2017 @01:49PM (#15340975)
However React == React Native evals as true due to type conversion (in ECMAScript projects with or without a patent grant are both considered 'truthy'). Really even === is not good enough, The only reliably why to test for it right now is to put a patent claim against FB inside a try-catch.

* I am not a lawyer and this should not be taken as legal advice.

Re:React 16 by jonknee on Tuesday September 26, 2017 @01:15PM (#15340640)
Well, react-dom !== react-native. Both projects use core react.
Re:React 16 by codelike on Tuesday September 26, 2017 @06:14PM (#15343019)
I've just finished reading https://code.facebook.com/posts/1716776591680069/react-16-a-... and it provided lots of good insights into how you managed to roll out the new release. Thanks for the interesting write-up!

That blog post mentions your featureFlag approach, the initial dogfooding and then the gradual rollout. I'd be very interested to hear on top of that:

1. How did you approach the rewrite on the coding side? What I mean is: Did you just say "Okay, let's start from scratch and use the lessons learned from v1?" Or did you use a specific approach along along the lines of: "Let's structure our code based on these principles and ...?"

2. When you started the rewrite, how did you know in advance and make sure that the rewrite would be faster and have a smaller code-size?

3. Was your focus during the rewrite on a cleaner code base (and the performance improvements followed automatically) or was your focus on speed right from the start?

4. Any other lessons learned during the rewrite? Patterns and approaches that helped/didn't help during the coding?

Re:React 16 by dean on Tuesday September 26, 2017 @03:27PM (#15341758)
The conventional wisdom in software development is to never rewrite your application from scratch. Typically it's much more difficult than you thought it would be, and it takes too long. Meanwhile, competitors pass you by (remember Netscape?). Just wondering how you came to make the decision to do this, and what, if any, concerns came up along the way?
Re:React 16 by dahart on Tuesday September 26, 2017 @04:53PM (#15342411)
The blog post mentioned getting test coverage before starting: https://code.facebook.com/posts/1716776591680069/react-16-a-...

I always remember how the SQLite author Richard Hipp talked about being able to rewrite major chunks of the SQLite engine due to their test coverage. Their testing page currently says they have 730x more test code than core library code. https://www.sqlite.org/testing.html

Re:React 16 by brokencode on Tuesday September 26, 2017 @04:01PM (#15342044)
The conventional wisdom applies to large, complicated software. The source for React comes in at around 109kb now. That couldn't be more than 10-20 thousand lines of code, which is quite small.
Re:React 16 by koolba on Tuesday September 26, 2017 @01:13PM (#15340623)
Kudos on both the release and the licensing changes.

Why remove the dist folder that was in prior releases?

Re:React 16 by spicyj on Tuesday September 26, 2017 @01:28PM (#15340770)
It's been renamed to "umd" for clarity.
Re:React 16 by bcherny on Tuesday September 26, 2017 @12:42PM (#15340328)
Thanks for the hard work! This release looks really exciting and I can't wait to try it out.

Out of curiosity, did you switch to Rollup for the tree shaking optimizer, or for some other reason?

Re:React 16 by danabramov on Tuesday September 26, 2017 @12:53PM (#15340429)
We used it because it produces a single flat bundle without extra module boundaries. I think webpack 3 might do the same with the experimental concatenation plugin, but we're fairly happy with Rollup.
Re:React 16 by bcherny on Tuesday September 26, 2017 @03:14PM (#15341657)
I see, and the benefit there is faster startup due to less IIFEs?
Re:React 16 by danabramov on Tuesday September 26, 2017 @06:01PM (#15342899)
Yes. It's also nice that we don't expose the internals anymore, even when consumed via CommonJS.
Re:React 16 by dfabulich on Tuesday September 26, 2017 @04:16PM (#15342140)
Will it ever be possible to slim down React to the size of Inferno or Preact? Would it be enough to make the synthetic event system optional?
Re:React 16 by danabramov on Tuesday September 26, 2017 @06:00PM (#15342890)
We'll be looking into simplifying the event system in the future.
Re:React 16 by fiokoden on Wednesday September 27, 2017 @06:13AM (#15346303)
JavaScript library update without massive shameless breaking changes. Weird.

It's just not the way things are done in the JavaScript world.

Re:React 16 by zitterbewegung on Tuesday September 26, 2017 @01:09PM (#15340573)
Will the new performance improvements also trickle down to react-native and or react-vr ?
Re:React 16 by danabramov on Tuesday September 26, 2017 @01:51PM (#15340996)
Yes.
Re:React 16 by k__ on Tuesday September 26, 2017 @02:32PM (#15341369)
Since RN is using 16 for a while now, they already did, or am I wrong?
Re:React 16 by spicyj on Wednesday September 27, 2017 @01:36AM (#15345168)
If I'm not mistaken, https://github.com/facebook/react-native/commit/b58207e61fcb... enables the new implementation in RN. So it'll be in React Native 0.49.
Re:React 16 by danabramov on Tuesday September 26, 2017 @06:02PM (#15342915)
The "react" package is mostly irrelevant here since it only contains a few utilities. The actual reconciler is synced separately, and no, it isn't enabled in RN yet (but maybe will be in the next stable release).
Re:React 16 by aurnik on Tuesday September 26, 2017 @03:07PM (#15341612)
Do RN projects just need to upgrade React then?
Re:React 16 by danabramov on Tuesday September 26, 2017 @06:04PM (#15342924)
No. We'll update RN with the new reconciler in the next few versions.

Don't expect it to magically improve performance though. But the async stuff mentioned in the post will definitely come to RN when it is ready.