Do you not have a database for your backend? Managing state is kind of their thing.
Do you not have a database for your backend? Managing state is kind of their thing.
So, when building for the web you'll essentially have 2 different categories of state: server and client.
Server state is obviously what's pulled fromt the db, but that's 100% not where something like form state should be stored. Or button toggle state. Or whether a modal is open, etc.
And it makes me think you haven't had as much experience as you think.
How do you deal with form state using CSS? Where does it get stored? In the html as elements? So not on the server?
For really simple stuff you can use CSS sibling selectors: https://jsfiddle.net/Kqscu/4/
For more complicated stuff, it is in the html as elements. With htmx you can often do this by making a request to the server to update a subtree; the server doesn't need to know the state that the user is seeing, just what is happening in the specific request.
Sometimes just updating html subtrees isn't quite enough, and then I use javascript. Transient state that is only concerned with what is presented to the user is probably not best done on the server.