4 ms·
This is exactly where my company was headed. We had a JS framework that creeped closer and closer to a full-blown data-attribute controlled environment. We use
by RobertRoberts 8y ago
This is exactly where my company was headed. We had a JS framework that creeped closer and closer to a full-blown data-attribute controlled environment. We use a ton of SSR to serve the views, and it is fast on every device and system. It's easy to iterate and add features and with very low overhead.
But... it hit a point where Vue.js was just so far superior to our own inhouse framework, that any interface that needs highly interactive component get's Vue now. Since Vue can run as a script file (hoping it gets the full ES module treatment soon) then we can splash it around anywhere in the interface we want, just like jQuery and our custom framework.
Now our system is like this: SSR > Full page > Vue app/vanilla js tweaks.
Updates are: AJAX/fetch a block of HTML into an element, and it can be a full Vue app, or just a block of content.
It's interesting to see that Basecamp ran into the same problems we did and didn't find that the full-on SPAs everywhere was the right solution for them. It's a nice bit of confirmation that there are many different ways to solve a problem that are valid.
- WorldMaker 8y agoAs 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.
- nemothekid 8y ago>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.
- yebyen 8y agoYou 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 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!
- tomnipotent 8y agoIncluding nearly 600kb of JavaScript for something that doesn't need it is insane.
- yebyen 8y agoI just went looking for a minimal react install and found this: https://github.com/krasimir/react-bare-minimum 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.
- tomnipotent 8y agoReactDom 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 https://github.com/developit/preact
- yebyen 8y agoI've heard of preact! Thanks for reminding me of this
- WorldMaker 8y agoThat "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 https://github.com/facebook/react/releases [2] https://mathiasbynens.be/demo/jquery-size https://mathiasbynens.be/demo/jquery-size