Live data from Hacker News

Stimulus.js 2.0

discourse.stimulusjs.org

11–20 of 140 posts

Re: Stimulus.js 2.0

#12

Is there a convincing Stimulus vs. React-Rails post anywhere?

Or a convincing Stimulus vs. Vue post would be helpful too, since Vue is so simple to sprinkle in as well, and doesn't pollute the html with data attributes as much as Stimulus.

Re: Stimulus.js 2.0

#13
post #10
post #9

Earlier quoted context omitted.

Htmx is more like all „we try to solve everything for you but fail“ solutions. The good part of stimulus is that it is only a binding library, no automatic content refetch etc. solution

I think the much touted "NEW MAGIC" will be the thing that does the automatic content refresh.

> I think the much touted "NEW MAGIC" will be the thing that does the automatic content refresh.

The StimulusJS handbook has an automatic content refresh example at https://stimulusjs.org/handbook/working-with-external-resour....

As for NEW MAGIC, DHH mentioned it will have a Rails server side aspect to it so I don't think we can compare these tools directly.

He did say other server side frameworks could implement similar behavior too but it would involve the framework having built-in support for websockets and job queues. This is based on a question I just asked him on Twitter at https://twitter.com/dhh/status/1334953167327547397.

So it sounds like NEW MAGIC will probably make it super easy to push / broadcast stuff from the server to the client, but to get everything working with a really nice API and it being seamless will require a substantial amount of work if you planned to re-invent it in another framework.

Re: Stimulus.js 2.0

#14
Alpine.js is worth a look as well [1]. I've been working with it as part of the newly christened "PETAL stack" [2] of Phoenix, Elixir, Tailwind, Alpine.js, and LiveView.

[1] https://css-tricks.com/alpine-js-the-javascript-framework-th...

[2] https://thinkingelixir.com/podcast-episodes/021-tailwind-css...

Re: Stimulus.js 2.0

#15

Is there a convincing Stimulus vs. React-Rails post anywhere?

Or a convincing Stimulus vs. Vue post would be helpful too, since Vue is so simple to sprinkle in as well, and doesn't pollute the html with data attributes as much as Stimulus.

One benefit is when combined with Turbolinks there is a need to bootstrap the Vue/React component. The Stimulus controllers respond to mutation observers and always work.

If a new HTML element is added to the DOM and has a controller, it just works and is now active. This might not be the case with React or Vue, as you'd have to then bootstrap the component.

This makes Stimulus a really good combo when used with Turbolinks or partial Javascript responses.

Post reply on HN