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

Persistent state with Local Storage #18

Open
JamiesonRoberts opened this issue Nov 20, 2019 · 1 comment
Open

Persistent state with Local Storage #18

JamiesonRoberts opened this issue Nov 20, 2019 · 1 comment

Comments

@JamiesonRoberts
Copy link
Contributor

What are your thoughts on pico having an opt-in ability to store the app's state into local storage for the browser, this could help cut down on web requests on ajax heavy pages for example an e commerce shop with a cart. The cart could be stored in state and then immediately hydrated instead of having to wait for a fetch.

@estrattonbailey
Copy link
Collaborator

I hear ya, it's a common enough need. Considering this is pretty easy to do manually, I kinda think it should stay out of the main library, just in an effort to not add bulk. There might be a good way to abstract this also, like into a higher order function of some kind like:

import { picoapp } from 'picoapp';
import persist from 'picoapp/persist';

const app = persist(picoapp)({ ... });

What do you think of that?

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