picoapp
picoapp copied to clipboard
Persistent state with Local Storage
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.
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?