Hacker News new | ask | show | jobs
by phaedryx 2025 days ago
I worked with Stimulus for about a month and found it to be frustrating:

1. There is not a lot of documentation

2. They don't provide any testing guidelines, the best I've found is hand-wavy test-with-a-browser stuff

3. Everything is essentially global

4. Functions are disconnected from their parameters, i.e. I can't tell which bits of data a function is using without digging through a bunch of code.

5. Putting state in your HTML is tricky if you also want to modify the DOM.

6. Their naming scheme is cumbersome, e.g. data-controller="using-a--sub-directory" and data-target="some--nested--target-has-a.function", that is, the fact that everything is location-in-your-code-file-structure based.

And a lot of other small things.

Ironically, using Stimulus convinced me to switch to Vue because I liked their value proposition of "Javascript sprinkles for your HTML", which Vue lets me do, but more intuitively.

3 comments

Ditto. I think if you are an experienced web app dev, understand the pros and cons of something like Stimulus, and set out from the beginning of your project to make PRODUCT decisions within the constraints of something like Stimulus and being more SSR. Then it is a great tool.

Anything more complicated though, and you are better off with Vue, React, Etc

I am an experienced web dev and went into Stimulus excited to have something that seemed straightforward, but was disappointed. Vue has the flexibility to do SSR HTML with a bit of javascript for behavior way that works well for me.

Just being able to put

    <button @click.prevent="save(<%= id %>)">Save</button>
Instead of:

    <button data-action="click->some--long--path-to#save" data-id="<%= id %>">Save</button>
...

    save(event) {
      event.preventDefault()

In my HTML has been worth the switch for me.
I've personally hit the point where I feel like React is my go to for anything - especially with Gatsby.

* If I'm keeping it simple, it's barely different than pure HTML. * Free templating * If I need Javascript (which I likely will), it's extremely easy to add anything I need.

I like React a lot and I sometimes use it for my own projects (e.g. I just finished https://techadequiz.com/)

However, I don't think React does "add some Javascript behavior to my Rails views (or backend framework equivalent)" very well (which is what I think Stimulus is trying to do). I mean you have solid support for React in the Rails ecosystem, but you turn your HTML-rendering responsibilities over to React Javascript functions.

But you get blank page until js kicks in?
I haven't had a problem. In my experience, I can actually get content up more quickly than a traditional CMS-type system.

Gatsby does some intelligent bundling so each page is pretty much self-bundled.

* Root HTML file

* Core, common JS (cached after first load)

* Page specific JS (also cached on subsequent loads)

For me, this is 257 kB uncompressed - with most of that being the Root HTML file (I realized I don't have minification or Gzip on - which takes that down substantially). Not a tiny payload, but the content is all static so the response comes back extremely quickly.

Even at slow 3G speeds, I barely get a flash. The actual page loads just about as quickly as HN.

With modern internet, the load time is nearly instant AND is literally instant on subsequent page loads (since most of the payload is locally cached).

Not if you use Gatsby or NextJS and get server side rendering out of the box
Why backend of web development is narrow down to nodejs server? How about people who use Rust/Python/Ruby/Elixir/PHP?
Doesn’t vuejs require you to keep your state in a store object (data: {}) and render html via js though?
No, you can just use normal HTML, add some vue-specific stuff and then treat that HTML as Vue app.

It’s how people use Vue as a jQuery replacement.

No it is flexible and Vue 3 let's you do it more react-hooks style.
It feels very much like Knockout which reminds me of the same frustrations
Huh? I think Knockout.js was awesome for its time! To me, Vue.js feels like Knockout’s spiritual successor. What did you find frustrating about Knockout?