AI Features

Introduction to Managing State in Stimulus Code

Let’s dive deeper and explore the state maintenance functionality available in Stimulus.

Managing state in Stimulus code

As we’ve been building our sample concert application in this course, we’ve spent a lot of time worrying about managing state. By managing state, I mean the set of values the front end needs in order to draw the correct information to the screen and properly manage user interaction. So far, our Stimulus page manages state by writing and reading values directly from the DOM, while our React page passes state variables up and down the component tree to ensure that all the components are working off of the same data.

As our ...