Live data from Hacker News

React v15.0

facebook.github.io

41–50 of 174 posts

Re: React v15.0

#42
post #23

Earlier quoted context omitted.

It is time to deploy common JS libraries out of band, like native libraries. Download them once, precompile them once, and then use precompiled version at any site, which requires it.

That's basically the purpose of public CDN-hosted JavaScript, like cdnjs [1] and what most major JS libraries do [2]. However, I think this is becoming less common with the increasing popularity of module bundlers like webpack. It's still possible with webpack [3], but it's not as easy as a 'npm i react' and 'import React from "react";'. That said, a module bundler could easily automatically swap out local modules fo…

I mean, we need tag in addition to tag, which we already have.

e.g. " rel="nofollow">https://cdn/react-5.0.8.js">

Re: React v15.0

#43
post #23
post #19

Is there a reason why the file size has exploded? react.min.js is now 145.4kb. For comparioson, angular.min.js is 155.2kb. One of React's biggest selling points was that it was much smaller than Angular/Ember/Backbone etc, but I'm not sure that argument can be leveraged anymore. I think React is a culmination of some great ideas, but in my view this is a big step back. Especially since Angular/Ember/etc. offer a lot…

It is time to deploy common JS libraries out of band, like native libraries. Download them once, precompile them once, and then use precompiled version at any site, which requires it.

It would be kind of nice if you could import modules directly from HTTP sources, like Go. For example:

    import _ from package 'github.com/lodash/lodash/tree/4.8.2';
    import $ from package 'jquery.com/version/2.2.0';
Your browser would make the OOB requests and cache the results in a shared directory, which any JS code that's running locally can use. This way, HTTP requests for 3rd-party components shared across websites aren't repeated over and over again for the same libraries. And it could even be extended to CSS:

    @import package("github.com/twbs/bootstrap/tree/3.3.6");

Re: React v15.0

#44
post #21

Earlier quoted context omitted.

I don't think we've ever promoted React based on file size. Smaller files are better but people tend to overemphasize JS file size -- gzipped, this latest release is 43k which is comparable to the size of an image or two on most websites. (Also note that growing framework code can reduce your app code size overall; I don't want to make specific claims about React but at Facebook we often see code size increase when 1…

This release gained 3k gzipped (it was 39k), in large part due to complete SVG support. In this case I think it was worth it because this was a longstanding pain point. There may be some ways to drop some dead code that we haven't eliminated efficiently yet. Here is a recent example I found that drops 1kb: https://github.com/facebook/react/pull/6401 It would be cool if somebody in the community could spare some time…

> I plan to write a high level overview of React internal implementation

I would love this! I really like how you basically re implement redux in the first few videos of your EggHead Redux tutorial. It really took my understanding to another level.

Re: React v15.0

#45

Earlier quoted context omitted.

Just out of curiosity, why do you only consider gzipped size when determining bloat? Transmission size/time isn't the only factor, there's also the time it takes the JS engine to process the code. 43k gzipped is okay for the transmission, but the engine is still parsing/processing the unpacked version, no? 145k minified for a foundational library is not insignificant. jQuery 3.0 minified as a reference is ~86k.

You're not wrong, it's just that the time it takes to transfer something across a network is usually slower and a lot less deterministic than processing something locally on your machine. While I'm pretty sure it takes longer to evaluate more code than less code, I would imagine that the time differential is negligible compared to the time savings you get from gzipping JS/CSS assets for transmission over a network. O…

Parent is not saying not to gzip. They're saying that more js takes more time to parse, regardless of compression. Iow, they are not talking about decompression overhead, they are talking about what happens after decompression.

Re: React v15.0

#46
post #40

If you are using typescript, you should read: https://github.com/Microsoft/TypeScript/issues/7270 TLD'R: React 15.0 broke TSX in typescript but the workaround is easy.

We didn't realize this would break. We're looking at cutting a 15.0.1 that puts React.__spread back with a warning.

Re: React v15.0

#47

React 14.x was built with babel 5.x. React 15.x is compiled with babel 6.x. Must user jsx code now be compiled with babel 6.x to be compatible with React 15.x?

Nope, it shouldn't affect you at all. (Otherwise it would have been noted in the blog post -- that should have all the info you need to upgrade.)

Re: React v15.0

#48
post #34

Earlier quoted context omitted.

I noticed you italicized the word grant . In reality the "grant" isn't granting; it is taking away. Let me explain: If React didn't have an explicit "grant" there would be an implicit grant. Is the explicit grant better than an implicit grant? It isn't because the explicit grant has what is known as a strong retaliation clause . More info on weak vs strong retaliation clauses: http://www.rosenlaw.com/lj9.htm React's…

> If React didn't have an explicit patent grant then there would be an implicit grant which does not have any retaliation clauses, and cannot be revoked. I'm not a lawyer. My understanding is that this is hypothetically possible but stands on shaky legal ground and has no legal precedent. Whether or not an implicit grant exists seems to depend on who you ask. This is apparently why GPLv3 includes an explicit grant. I…

If React doesn't have any patents then Facebook could solve this issue by removing the "grant" or by removing the strong retaliation clause from the "grant".

I am not a lawyer either, but I think the idea of implicit grant is compatible with common sense.

Re: React v15.0

#49
post #21
post #19

Is there a reason why the file size has exploded? react.min.js is now 145.4kb. For comparioson, angular.min.js is 155.2kb. One of React's biggest selling points was that it was much smaller than Angular/Ember/Backbone etc, but I'm not sure that argument can be leveraged anymore. I think React is a culmination of some great ideas, but in my view this is a big step back. Especially since Angular/Ember/etc. offer a lot…

I don't think we've ever promoted React based on file size. Smaller files are better but people tend to overemphasize JS file size -- gzipped, this latest release is 43k which is comparable to the size of an image or two on most websites. (Also note that growing framework code can reduce your app code size overall; I don't want to make specific claims about React but at Facebook we often see code size increase when 1…

Perhaps the React team didn't themselves promote based on file size, But many people have in medium articles etc. I'm the kind of person who works very hard to keep my page size at a minimum, and there are definitely others like me. What do you think of the idea of splitting React up into several files, so you can only input what functionality you want? Do you think that's possible in Reacts code base? For reference, RxJS 5 does this, so you can import the operator flatMap only if you intend to use it.

Re: React v15.0

#50
post #34

Earlier quoted context omitted.

I noticed you italicized the word grant . In reality the "grant" isn't granting; it is taking away. Let me explain: If React didn't have an explicit "grant" there would be an implicit grant. Is the explicit grant better than an implicit grant? It isn't because the explicit grant has what is known as a strong retaliation clause . More info on weak vs strong retaliation clauses: http://www.rosenlaw.com/lj9.htm React's…

> If React didn't have an explicit patent grant then there would be an implicit grant which does not have any retaliation clauses, and cannot be revoked. I'm not a lawyer. My understanding is that this is hypothetically possible but stands on shaky legal ground and has no legal precedent. Whether or not an implicit grant exists seems to depend on who you ask. This is apparently why GPLv3 includes an explicit grant. I…

>It could also be that there aren't any patents that cover React.

If that is the case, why have this controversial patent clause at all?

I haven't read them all, but Facebook seems to have a number of patents which at first glance are so broad they could apply to react:

https://patents.google.com/patent/US20160092096A1/en "a method performed by one or more computing devices including defining a hierarchical structure for a user interface (UI) that includes defining one or more layers of the hierarchical structure, adding one or more objects at each layer, and specifying one or more relationships among particular objects"

https://patents.google.com/patent/US20160091953A1/en "Adjusting mobile device state based on user intentions and/or identity"

https://patents.google.com/patent/US20150277691A1/en "In one embodiment, as a user is scrolling through a first series of content items and reaches the nth content items from the first series of content items, display a visual indication that there are additional content items from the first series of content items existing after the nth content item."

https://patents.google.com/patent/US20150113066A1/en "A communications system including one or more alert gates and an alert controller. Each alert gate is configured to detect a different type of alert feed corresponding to a particular kind of alert. The alert controller is connected to the alert gates and operable to receive detected alerts from the alert gates and to deliver the detected alerts to a user of the communications system."

https://patents.google.com/patent/US20160086219A1/en "methods and systems that allows for improved user navigation within a group of content items."

I actually had no idea Facebook's patent portfolio was so broad. There are countless more: https://patents.google.com/?q=G06F3%2f048&assignee=Facebook+...

Post reply on HN