title: Stimulus, JS and HTML
lang: en

> Stimulus is concerned with manipulating this existing HTML document. Sometimes that means adding a CSS class that hides an element or animates it or highlights it. Sometimes it means rearranging elements in groupings. Sometimes it means manipulating the content of an element, like when we transform UTC times that can be cached into local times that can be displayed.
> 
> […]
> 
> This makes Stimulus very different from the majority of contemporary JavaScript frameworks. Almost all are focused on turning JSON into DOM elements via a template language of some sort. Many use these frameworks to birth an empty page, which is then filled exclusively with elements created through this JSON-to-template rendering.
> 
> Stimulus also differs on the question of state. Most frameworks have ways of maintaining state within JavaScript objects, and then render HTML based on that state. Stimulus is the exact opposite. State is stored in the HTML, so that controllers can be discarded between page changes, but still reinitialize as they were when the cached HTML appears again.
> 
> <cite>*[The Origin of Stimulus](https://github.com/stimulusjs/stimulus/blob/master/ORIGIN.md)* ([cache](/david/cache/8c3ee729edc11c25b31a3cec6d59e7ae/))</cite>

A different paradigm, an old one actually, revisited. I’m more inclined to use that kind of approach *given my usual needs*. And if it gets bigger, it’s probably not my fish and I’m happy with that. It looks more robust by default and does not serve a blank page [for whatever valid reason](/david/blog/2017/without-javascript/).