Hacker News new | ask | show | jobs
by bruncun 3093 days ago
As a Turbolinks fan, I couldn't be more excited about Stimulus. Sounds like it completes the front-end development story with Rails-like simplicity minus requiring that you know Ruby and Rails.

I started off as a FE dev working on mostly Rails projects. Not knowing Ruby or Rails, I depended on others for updating controllers, debugging Rails errors, etc. I was also commonly frustrated when my teams treated the client as a second-class citizen for no apparent reason besides an aversion to JavaScript. JS' takeoff in the market was actually quite satisfying at first, but the more I worked with Angular, React & company, the more I missed the productivity of server-rendered JS responses, jQuery, and Turbolinks. I doubt Turbolinks + Stimulus wins prom king at JavaScript High next year, and I couldn't care less.

Also, Redux as "self-congratulatory" had me dead. XD

3 comments

I'm a fan of Turbolinks too (started using it on its day 1 release), but nowdays you don't even need Rails to use it effectively. It integrates with any framework very easily.

Stimulus is a new upcoming framework for sprinkling in bits and pieces of JS. DHH talked about it on https://twitter.com/dhh/status/946184709528158208.

Yup - love using it for static sites!
For things like auth/signup/forgotten-password flow I'd agree I've been more productive with server-side frameworks than client-side, and the out-of-the-box solutions for those things from Rails/Django feel more solid.

Also basic blog and structured content 'pages' sites.

For building anything that requires complex client-side interaction, i.e. the sort of things that even warrant looking at React (e.g. a calendar app, or a music player app), then you're going to get yourself in a real mess attempting that with 'javascript sprinkles'.

> Also, Redux as "self-congratulatory" had me dead. XD

Also completely wrong if you've ever read/heard anything Dan Abramov has ever written/said [1].

[1] https://medium.com/@dan_abramov/you-might-not-need-redux-be4...

I believe Abramov was the first to say, “You might not need Redux.” What prompted that?
Yes! Perfect example, added to my comment :)
What does stimulus do?
Its something they've been developing internally at Basecamp. DHH sees Turbolinks handling "90%" of front end work related to full page changes. Stimulus (which I think he said they're releasing in another month) will handle on page interaction or as he calls it "Javascript sprinkles". Things like modifying existing elements, adding a new node to the DOM, filtering, etc.
A bit like what Drab does for Elixir/Phoenix perhaps?
I'm far from an authority to officially say, but this is what I gathered from listening to the podcast:

Stimulus essentially structures DOM manipulation. Whereas other frameworks aim to solve rendering, it seems Stimulus will offer a lo-fi and sane way of making your views dynamic. Restated, it's a framework for managing JS sprinkles aka jQuery spaghetti aka templating logic. I don't think its a component library because DHH explicitly mentioned its not a mechanism designed for handling JSON and similar concerns. It targets the realm of updating element classes and attributes, handling events, etc. It'll also allow you to partially update views with HTML templates sent over the wire.

When combined with Turbolinks, it should elegantly solve all your everyday front-end concerns. There's a lot of helpful context I'm neglecting - check out the podcast, DHH pretty much opens with this topic.

I had the same question :-)
Maybe a typo? A search for 'ruby rails stimulus' brought me right back to the root comment. About to listen to the podcast. Will report back if I learn anything.
This was a teaser - it's not out yet.
Thanks for clarifying. That was my takeaway as well.