You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use zustand's built-in middleware for that
import{createWithSignal}from'solid-zustand'import{persist,createJSONStorage}from'zustand/middleware'exportconstuseBearStore=createWithSignal(persist((set,get)=>({bears: 0,addABear: ()=>set({bears: get().bears+1}),}),{name: 'food-storage',// name of the item in the storage (must be unique)storage: createJSONStorage(()=>sessionStorage),// (optional) by default, 'localStorage' is used},),)
Is there a way to persist state in localStorage or Indexeddb or other persistent ways? Then when the app starts it loads the state again
The text was updated successfully, but these errors were encountered: