#persist data across reloads | R3F

11 messages · Page 1 of 1 (latest)

tidal basin
#

I have a button which adds objects to the scene, the positions could be changed by user. I'd like to persist the data I,e positions and how many objects are there until the browser window closes. Any suggestions on how can I achieve this?

hexed ermine
#

Sounds like a job for useState

tidal basin
#

State loses when page reloads

#

It's either cookies, sessionStorage or localStorage

hexed ermine
#

Yeah, I didn't catch that you really want it to persist on refresh/reload. I suppose sessionStorage or localStorage, depending on how you want the expiration to work.

olive ridge
tidal basin
tidal basin
olive ridge