Closed MatheusLopesDev99 closed 2 years ago
Hey Guys, i am using the little-state-machine to store some data, but the default of the library is to use sessionStorage.
I am trying to change to localStorage but without success, returns error:
e.setItem is not a function
import React from "react"; // Sheets import "../styles/globals.css"; import "../styles/globals-mobile.css"; import "../styles/bootstrap.min.css"; import { SnackbarProvider } from "notistack"; import { StateMachineProvider, createStore, setStorageType } from "little-state-machine"; createStore( { user: null, oferta: {}, mensagensAgendadas: [], metricas: {}, }, { storageType: window.localStorage } ); function MyApp({ Component, pageProps }) { return ( <> <StateMachineProvider> <SnackbarProvider maxSnack={3}> <Component {...{ ...pageProps, }} /> </SnackbarProvider> </StateMachineProvider> </> ); } export default MyApp;
could you share a codesandbox on the localstorage usage?
Hey Guys, i am using the little-state-machine to store some data, but the default of the library is to use sessionStorage.
I am trying to change to localStorage but without success, returns error:
e.setItem is not a function