4 ms·
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,
by phaedryx 6y 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.
- hfourm 6y agoDitto. 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
- phaedryx 6y agoI 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.
- SkyPuncher 6y agoI'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.
- phaedryx 6y agoI like React a lot and I sometimes use it for my own projects (e.g. I just finished https://techadequiz.com/ 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.
- Existenceblinks 6y agoBut you get blank page until js kicks in?
- tomduncalf 6y agoNot if you use Gatsby or NextJS and get server side rendering out of the box
- Existenceblinks 6y agoWhy backend of web development is narrow down to nodejs server? How about people who use Rust/Python/Ruby/Elixir/PHP?
- SkyPuncher 6y agoIt's not. If you're building a backend heavy use-case, there are plenty of good options. Gatsby is geared towards building web pages, not web applications. If you're implementing Gatsby, you're building essentially HTML pages, possibly with some JS functionality.
- Existenceblinks 6y agoIt's interesting to me to explore this type of application that is interactive web page, but not web applications Usually, the more interaction, the more likely it's application. The more it's just a page, the more it should be just HTML.
- RedShift1 6y agoIt feels very much like Knockout which reminds me of the same frustrations
- andrei_says_ 6y agoDoesn’t vuejs require you to keep your state in a store object (data: {}) and render html via js though?