DEV Community

Discussion on: 25 reasons to switch to Webpack(er)

Collapse
 
andrewmcodes profile image
Andrew Mason

Have you tried Stimulus?

Collapse
 
victorhazbun profile image
Victor Hazbun

I have seen many users having issues with it and not being able to find solutions in the internet. The framework adoption is not so great, so it is hard to work with it (for now).

Collapse
 
leob profile image
leob • Edited

That is the problem, the community around it is small. I severely doubt if it solves that many problems which you can't just as easily solve with jQuery or vanilla JS.

My impression (when looking at the docs and examples) was that it was a bit heavy on boilerplate, and I'd even go as far as calling it "invasive", it permeates through both your HTML templates (via the data attributes) and obviously the "controllers".

And, I think it sort of breaks down when your use case requires you to create/append new DOM elements, because it relies heavily on server generated markup with "data" elements. I'm not saying that it wouldn't work with dynamically generated DOM elements but that doesn't seem a natural use case.

Look at this thread:

reddit.com/r/rails/comments/df01hd...

If you read through it it confirms some of my doubts. I wouldn't paint myself in a corner by tying my app to a somewhat obscure library like StimulusJS.

It is a nice concept but I think that for many use cases the risks and drawbacks exceed the advantages.

Thread Thread
 
andrewmcodes profile image
Andrew Mason

It’s worth mentioning I work on app that has scaled stimulus. And the community is growing larger and larger in my limited view.

I don’t think I can adequately convey my counterpoints without turning this in to an argument or writing a novel so I’ll just leave it at: it’s not for everyone or every product (which is true of everything) but truly shines when you are already leveraging turbolinks and even more in an app backed by Rails 🙂

Thread Thread
 
leob profile image
leob • Edited

Right, yes the combo with Turbolinks is its sweet spot I think ...

Do you think it works well when you need to dynamically generate/append DOM elements (as opposed to working with existing server side generated markup only)? For instance, in a heavily AJAX based UI where you need to add new elements to a list after an AJAX call (without a page re-render) ...

Collapse
 
leob profile image
leob • Edited

Looked briefly at it, supposedly it works well in combination with Turbolinks (the life cycle of StimulusJS is compatible with that of Turbolinks). It's even possible to use Stimulus and Turbolinks with other frameworks, e.g. Laravel.

However after having looked at a few tutorials I wonder how well it "scales" to more complex UIs, even for pretty simple UIs I had the impression that the amount of boilerplate was on the high side, it seemed to require a lot of code even compared to when I'd code the same thing with jQuery.

I could be wrong though because I haven't actually used it on a real project.

Collapse
 
rossta profile image
Ross Kaffenberger

Not yet!