storu
usage
import StoruProvider from 'storu'import * as actions from './actions' { return <StoruProvider => <Auth /> </StoruProvider>} { const storu = const useractionssetState = storu const isSignedIn = user&&username return <div> <span>username</span> !isSignedIn ? <button => sign in! </button> : <button => click to logout </button> </div>}
create your actions
storu
is injected as the last argument in each "action", with two methods:
storu.setState
: set state into the contextstoru.setStore
: set state that is also persisted to localStorage
{ const user = await axios storu}