Stimulus JS Framework from Rails/DHH/Basecamp

UPDATE: It's out at https://github.com/stimulusjs/stimulus, credit goes to /u/assassin-in-white

DHH/Rails/Basecamp planning to release new JS framework called Stimulus in this month.

Skip to minutes 12 for shorter details
Announcement at 14:00

TLDR:
- Independent from Turbolinks
- But need to combine both for full effect
- Render page using HTML response from the backend
- Support JSON and HTML response
- ...

https://devchat.tv/ruby-rogues/rr-342-rails-development-david-heinemeier-hansson

10 thoughts on “Stimulus JS Framework from Rails/DHH/Basecamp”

  1. I use a lot Server-generated JavaScript Responses (SJR), just with one line of .js.erb :

    `$(“#some-id”).replaceWith(“<%= j render partial:'...' %>“);`

    I wonder how it could be simpler than this, really excited to know more about Stimulus !

    Reply
  2. This looks fantastic.

    We’ve been using light weight Vue components with a nice way to bootstrap them. The problem is when you need to share the same client side state between them.

    It doesn’t happen very often, but a good example is a beginning at and ending at time field where changing the ending at should also affect the beginning at.

    I’ve considered writing a plugin, but Vue doesn’t really want to work this way. It wants a single parent rather than many sibling components.

    When you’re doing the server side route you just want to enhance HTML rather than work against it.

    I need to spend some time with Stimulus, but it looks like I’d be able to write isolated components like a date time field and then bind their state together with a parent controller. It doesn’t make too many assumptions.

    Looking forward to giving it a shot.

    Reply
  3. I’m pretty interested in this. I’m currently working on a pretty straight forward CRUD app that I decided needed to be an API + VueJS frontend. However this has become WAY overly complicated and something rendered with ERB with a few little pieces of JS interactivity would be so much easier to work with. And with Turbolinks probably faster. I wish I hadn’t bought into the SPA hype so much.

    Reply
  4. Would Stimulus JS be a good fit for making a trello like application in Rails? I’m thinking of the “card moving around” functionality in Stimulus. Or should one go to a full fledged framework like React?

    Reply

Leave a Comment