Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing the localStorage of a browser #772

Open
JovanVeljanoski opened this issue Sep 4, 2024 · 1 comment
Open

Accessing the localStorage of a browser #772

JovanVeljanoski opened this issue Sep 4, 2024 · 1 comment

Comments

@JovanVeljanoski
Copy link
Collaborator

Does solara provide access to (read/write/modify) the browsers "localStorage" ?

Thanks

@maartenbreddels
Copy link
Contributor

Hi Jovan,

no, we do not support that out of the box (although we would be interested in supporting it with reactive variables, but it's tricky to get the details right for general use).
However, a component can be made to sync to localstorage, e.g.:
https://py.cafe/maartenbreddels/solara-localstorage

The downside is that the initial render will be done with the default value, and (quickly) once the page renders, we set the value. I hope that is sufficient for your needs right now. Otherwise cookies might be a good solution, since you have direct access to that. I'll answer that in #773.

cheers,

Maarten

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants