Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As antagonistic as this Stimulus site seems to be towards React, it can be used similarly and you can tell it was built that way by Facebook who used it to replace a lot of bespoke jQuery slowly over time rather than write everything from scratch from day one. Contrary to some opinions, it's more than possible to have React handle only a small portion of a site incrementally, React itself isn't really a "SPA framework" out of the box. (It's the ecosystem of tools like react-router that make it a SPA.)

There are indeed many different ways to solve these problems. My biggest criticism with the Stimulus documentation here is that it feels so disparaging of other people's solutions.



>it feels so disparaging of other people's solutions

In many ways, I wouldn't expect less from Basecamp. Superiority and self-righteousness seems ingrained into basecamp's culture.


You should experience Railsconf once. For all of DHH's pompousness, he gets taken down a peg every year by Aaron Patterson's closing keynote.

This year he raged against the Twitter war that was waged on Foo, Bar and Baz

https://m.youtube.com/watch?v=cBFuZivrdT0

Lots of DHH ideas are take or leave. The consensus seems to be that you need to wait a while before embracing new features in Rails, because they are often released half-baked and frequently no good until the second try. (Take credentials for example, or turbolinks.)

That being said I am really interested in Stimulus, as based on the promotional pages at least, it seems like it is not very big and it would be hard to do wrong. I haven't "bit" for any JavaScript framework yet since jQuery, and consequently all my JavaScript is pretty terribly disorganized. It is very encouraging that this has made it to 1.1 without any apparent major overhauls!


Including nearly 600kb of JavaScript for something that doesn't need it is insane.


I just went looking for a minimal react install and found this:

https://github.com/krasimir/react-bare-minimum

When I was able to get it working, it came out to 880kb. That's more than (nearly) 600kb! I thought you were exaggerating.

The stimulus umd.js by comparison is 60kb uncompressed.


ReactDom is the actual culprit. Preact [1] is a great ~4kb alternative, though it's still on the v15 API.

React makes sense for something like Facebook/Instagram web where users interact with the app hundreds of times in a single session, but we can't fall into the trap of treating it like jQuery and hitting every nail we come across with it.

I'm hopeful that like jQuery, whatever features that make ReactDom et al. so large will eventually make their way upstream and be codified as browser specs.

[1] https://github.com/developit/preact


I've heard of preact! Thanks for reminding me of this


That "bare minimum" repo is including a lot of Babel polyfills. You could use Typescript instead of Babel, and shave off a bunch of polyfills in the process.

Comparing apples more to apples, while the react-dom.development.js is indeed ~600 kbs. The minified production build of react-dom is only ~70 kbs [1], which is is smaller than jQuery minified (but not gzipped) [2].

It's not necessarily React itself that is bloating these project sizes.

[1] https://github.com/facebook/react/releases [2] https://mathiasbynens.be/demo/jquery-size




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: