back

by codazoda·9y ago·view on hn ↗
I stopped reading at "both are fast and light weight" because I don't find react to be "light weight". React is 275K (nearly a quarter of a meg) when it is minified and gzipped. 750K when it is not minified/gziped.

We're talking about a web page UI here. It should be tiny for users with slow connections. React seems big to me and I can't justify it except in very large applications.

As such, I struggle to find the reason React is so popular. Perhaps I'm a bit old school. People say it's easy to reason about, but I don't find that to be true in real world large applications with a lot of developers working on them.

Still, I'm trying to like react, but these things are a struggle for me.

3 comments
> React is 275K (nearly a quarter of a meg) when it is minified and gzipped. 750K when it is not minified/gziped.

That statement is completely false.

react@15.5.4:

react.min.js is 21335 bytes uncompressed, 7353 bytes gzipped.

I'm including everything you need to deploy in those numbers. You included only React and not React-Dom. My own try at setting up React results in a 750k js file when I follow the instructions below. I realize this isn't minified yet and I welcome feedback on how to make it better.

https://www.joeldare.com/blog/post/create-a-react-app/

The top search results for react minified size show similar numbers to my 250k. There are a lot of people throwing out a lot of numbers that are different. Versions likely play a role, especially after 15. Here are some references.

https://gist.github.com/Restuta/cda69e50a853aa64912d

https://stackoverflow.com/questions/19807946/why-is-reacts-f...

Nothing I can find references a size as small as you mention with react and react dom. Most recommend writing with ES2016 which probably adds Babel overhead as well. When I build "Hello World" myself, I can't get anywhere near the small sizes.

I'd love someone to give me a proper smack-down on this. I want to love React since it's a recent requirement of my job. But with my current knowledge of it, I can't seem to get the size down.

You need to add uglify to your webpack.config.js.

https://webpack.github.io/docs/list-of-plugins.html#uglifyjs...

While I agree that React (with ReactDOM) is heavier than it probably should be, a production build is around 140k minified, 45k min+gzipped.

I personally find React applications to be fairly easy to navigate compared to other JS projects, but my use of it has primarily been porting applications from Angular, Knockout or Asp.net Webforms to React.. and I find it a lot easier to work with than those personally. Haven't tried Vue though.

> As such, I struggle to find the reason React is so popular.

Uhm, React websites run great in Chrome on a MacBook Pro. You seem to think that most web developers care about users on slow connections.

I am assuming that, yes. Websites with mass appeal should probably think about this. Yeah, I develop on a MacBook Pro with Chrome on a massive network connection, but I do an awful lot of web browsing on my phone from resteraunts and offices where there is somewhat crappy data coverage.