4 ms·
Ask HN: Data store recommendation when using Htmx
Saw a thread discussing htmx[1], and thought it was time to give it a go.
anyone have a recommendation for a simple cookie, localstorage, session etc library that works well with it?
[1] htmx.org
grateful for any replies!
- recursivedoubts 3y agowhat language? htmx should work fine w/ whatever backend library you are comfortable with. a lot of django folks have picked it up, but there are a million different language/framework combos.
- 3000 3y agosorry, i meant a js client side library. (on the backend im using php and arangodb.)
- recursivedoubts 3y agooh, you probably don't need much of one: when htmx makes requests it'll act like a normal web request and include cookies, etc. if you do want to do some client side stuff, Alpine.js is a popular and lightweight option
- 3000 3y agoyeah i had a look at alpine. will give them a go along side each other.
- leke 3y agoHow about the web native store?
- xvello 3y agoOne of the points of HTMX is to merge back all of the state to the backend, instead of spreading it between backend and frontend. For authenticated users, just store a user pref record on your database. For state that is not linked to a user account, use the standard session mechanism of your backend. Alternatively, just use good-old functional cookies, with the Set-Cookie HTTP header. Set them to be available to javascript if needed.