Hi all — I’m absolutely loving Stimulus and it’s matching up well with how my brain works and my past Rails experience. My question is this: how have you approached (if at all) the idea of adding client-side models to your frontend architecture and how that could work with your Stimulus controllers?
For example, I have a controller that handles two-way UI communication for a “post” on a timeline. When someone clicks a button on a post to, say, save that for reading later, I set it up so my Stimulus controller instantiates and calls a model object, and the model object is responsible for sending the relevant data up to the server. I like the feel of keeping data transformation and persistance in a separate layer than the Stimulus controller — that way I have true MVC on the frontend.
Right now, my model is just a POJO (loving those ES6 classes), and I’m not doing anything fancy like autoloading models. So that’s fine, but I guess I’m wishing there was a bit more framework magic under the hood so each model isn’t just a individualized snowflake.
Any thoughts? Other approaches?