Thanks for the writeup. I had the opportunity to use StimulusJS at a recent opportunity and couldn't agree with it. I found several issues with the patterns it encourages, such as:
-magic variable transformed from props, lots of uncertainty between the HTML attributes I typed and the actual name of the JS variable
-have to now define these magic variables in typescript
-defining values and automatically converting strings / numbers magically seems hacky
- why does it ask to separate CSS classes into it's own special attribute and magic variable?
I feel like I'm speaking crazy when I see anyone recommend Stimulus and from my experience I'd much rather just use web components without shadow DOM. Seriously, EVERYTHING Stimulus does web components do 10x better and cleaner. They both try to do the same thing but the Stimulus approach honestly came across as a high school final project taken too far.
If you think stimulus serves the same use case as web components, I think you haven’t used it enough or you just got it wrong.
Web components are more comparable to react, vue, svelte, etc. of course you can do anything stimulus do with web components, as you can also with react.
The point of stimulus, which is more comparable to Alpine, jQuery, knockout, etc is that you can just sprinkle behavior on existing server side rendered HTML. Web components and similar can’t do this as they have their own tenplating system, which mean no server side rendering without super complicated build tooling and architectures.
So, no, stimulus has nothing to do with web components. They’re complimentary to each other more than competitors.
-magic variable transformed from props, lots of uncertainty between the HTML attributes I typed and the actual name of the JS variable -have to now define these magic variables in typescript -defining values and automatically converting strings / numbers magically seems hacky - why does it ask to separate CSS classes into it's own special attribute and magic variable?
I feel like I'm speaking crazy when I see anyone recommend Stimulus and from my experience I'd much rather just use web components without shadow DOM. Seriously, EVERYTHING Stimulus does web components do 10x better and cleaner. They both try to do the same thing but the Stimulus approach honestly came across as a high school final project taken too far.