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
{{ message }}
Repository navigation
incrementAsync action in the example does not work. #126
import"./style";import{Component,render}from"preact";import{Provider,createStore,connect}from"unistore";letstore=createStore({count: 0});// If actions is a function, it gets passed the store:letactions=store=>({// Actions can just return a state update:increment(state){return{count: state.count+1};},// The above example as an Arrow Function:increment2: ({ count })=>({count: count+1}),// Async actions are actions that call store.setState():incrementAsync(state){setTimeout(()=>{store.setState({count: state.count+1});},100);}});constApp=connect("count",actions)(({ count, incrementAsync })=>(<div><p>Count: {count}</p><buttononClick={incrementAsync}>Increment</button></div>));render(<Providerstore={store}><App/></Provider>,document.body);
I tried the use it in the example given like above, just changed the increment to incrementAsync but it doesnt update the state.
I guess the problem is with the dependency versions. In the example unistore dependency version is 2.2.0 and in the one you sent its 3.1.0. So maybe version in the sandbox should also be bumped.
Activity
indatawetrust commentedon Nov 23, 2018
https://codesandbox.io/s/w2p786r788
tteke commentedon Nov 23, 2018
I guess the problem is with the dependency versions. In the example unistore dependency version is 2.2.0 and in the one you sent its 3.1.0. So maybe version in the sandbox should also be bumped.
nmquebb commentedon Jan 6, 2019
createStoreneeds to come fromunistoreandProvider/connectcome from its specific implementation (preact or react)