✨ Announcing our seed funding led by Lux Capital! Read more about it on our blog
DocsBlogChangelog

Search documentation...

/

Star

12k+

[ Learn ]

[ Concepts ]

[ Reference ]

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"),
)
← Special EventsApp →

Copyright © 2023 Pynecone, Inc.