Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Are you not familiar with building web apps?

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.



I have written web apps and about 80% of the sorts of things you are talking about can be handled with just html/css and I just use javascript for the other 20%. It's not like when you use htmx it disables all other javascript APIs.


We are talking about how state is stored, not about CSS.

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?


> 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: