Live data from Hacker News

React v15.0

facebook.github.io

151–160 of 174 posts

Re: React v15.0

#151
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…

I feel it's important to point out that React is now an ecosystem. Relay is comparable in size to React, then we throw Immutable into the mix, and so on. These are all dependencies that will be used on practically every page on a website, so cannot benefit from code-splitting techniques. It's certainly my experience that using React over a mess of jQuery and its plugins leads to smaller file-sizes when enhancing func…

Would it be possible to split those libraries in smaller modules? For example Preact (https://github.com/developit/preact) has the same basic API of React but it's just 3kb because a lot of features are stripped away in optional modules. Also, using preact-compat you could replace it as-is* in your bundle right now.

Re: React v15.0

#152
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…

I feel it's important to point out that React is now an ecosystem. Relay is comparable in size to React, then we throw Immutable into the mix, and so on. These are all dependencies that will be used on practically every page on a website, so cannot benefit from code-splitting techniques. It's certainly my experience that using React over a mess of jQuery and its plugins leads to smaller file-sizes when enhancing func…

For React you kind of have to use the minified file size, because the dev file size is SHOCK FULL of dev-only validation and error messages and other logic that is made to be minified away. The prod build isn't even close to the same code.

With that said React + ReactDOM is 180kbish unminified.

I can't find Relay's size as a single file. Is it really over 800kb?

Re: React v15.0

#153
post #152

Earlier quoted context omitted.

I feel it's important to point out that React is now an ecosystem. Relay is comparable in size to React, then we throw Immutable into the mix, and so on. These are all dependencies that will be used on practically every page on a website, so cannot benefit from code-splitting techniques. It's certainly my experience that using React over a mess of jQuery and its plugins leads to smaller file-sizes when enhancing func…

For React you kind of have to use the minified file size, because the dev file size is SHOCK FULL of dev-only validation and error messages and other logic that is made to be minified away. The prod build isn't even close to the same code. With that said React + ReactDOM is 180kbish unminified. I can't find Relay's size as a single file. Is it really over 800kb?

React unminified is ~660kb.

Re: React v15.0

#154

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…

Right, but you can use caching / service workers to solve the network time, but there's nothing you can do to speed up the initial javascript load time.

Re: React v15.0

#155

Earlier quoted context omitted.

I feel it's important to point out that React is now an ecosystem. Relay is comparable in size to React, then we throw Immutable into the mix, and so on. These are all dependencies that will be used on practically every page on a website, so cannot benefit from code-splitting techniques. It's certainly my experience that using React over a mess of jQuery and its plugins leads to smaller file-sizes when enhancing func…

I should add, that if there's a truly blessed CDN for these dependencies (cdnjs is the closest we have to that) that everyone uses, it puts us in a much better place. So we should actively be encouraging people to use them.

I love cdnjs.com but check out npmcdn.com

Re: React v15.0

#156

Amazing. Honestly, React made me love developing for the web again. It's a huge component of our software, and is what allows us to move so rapidly. Really happy to see the SVG support, and the continued fast-paced development of React. Onwards!

React made frontend much more enjoyale to me too, it's so quick to build nice things in it :)

Re: React v15.0

#157
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.

FWIW I used TypeScript in anger with React, and hated it so much I rewrote all the React code in regular JavaScript. TypeScript and React, IMO, are a poor fit. To be clear: I do like TypeScript and use it almost exclusively on the server, so this isn't a case of me "not liking TypeScript". It's the combination of the two. Basically, all of the stuff I did to keep TypeScript happy when using React was worthless overhe…

I have the opposite experience.

Re: React v15.0

#158
post #148

Earlier quoted context omitted.

Subresource Integrity is the standard for that https://www.w3.org/TR/SRI/

Do you know if this allows consolidation of multiple copies of the same resource from different hosts?

Not currently, because it conflicts with CSP. See https://news.ycombinator.com/item?id=10311020

Re: React v15.0

#159

Earlier quoted context omitted.

document.createDocumentFragment() https://developer.mozilla.org/en/docs/Web/API/Document/creat...

The documentation says this is faster because the browser does not have to compute reflow during DOM construction. But is this also true if the DOM tree is built "bottom up" (i.e., first the leaves, then their parents, etc, and then finally hook everything into the document body)?

Only one reflow calc at fragment hookup as opposed to a reflow for every child node added to the main DOM.

Re: React v15.0

#160
post #152

Earlier quoted context omitted.

I feel it's important to point out that React is now an ecosystem. Relay is comparable in size to React, then we throw Immutable into the mix, and so on. These are all dependencies that will be used on practically every page on a website, so cannot benefit from code-splitting techniques. It's certainly my experience that using React over a mess of jQuery and its plugins leads to smaller file-sizes when enhancing func…

For React you kind of have to use the minified file size, because the dev file size is SHOCK FULL of dev-only validation and error messages and other logic that is made to be minified away. The prod build isn't even close to the same code. With that said React + ReactDOM is 180kbish unminified. I can't find Relay's size as a single file. Is it really over 800kb?

I'll need to do a webpack report to get the actual numbers out.

However, my dev build is 9mb, my production build is 1mb. So when i'm talking about baseline filesize for a React + Relay project, I am talking about production builds. Not all of this 1mb comes from those two libs, but they contribute very heavily towards it.

Post reply on HN