Browser Storage
Local Storage
Aside from cookies, if for some reason you need to use the Local Storage on your Reflex app, you can do so with:
To read a local storage variable and pass it to an event handler, you can use
rx.button(
"Copy Local Storage to clipboard",
on_click=rx.set_clipboard(rx.get_local_storage("key")),
)
To write a variable inside the local storage, you can use the
special event rx.set_local_storage(key,value)
rx.button(
"Set Local Storage",
on_click=rx.set_local_storage("key", "value1"),
)
get_local_storage()
cannot be used for direct rendering