Differences between redux and dutier
Closed this issue ยท 6 comments
What are the main differences between dutier and redux?
I think Dutier
shares the same principles that Redux
, actions that return payloads that says how to work with the state without change them, just returning new values usign your state.
But dutier createStore
just sets your initial application state. Inside your components you will dispatch actions to be called by your reducers for change the state.
Dutier dispatch
method is async by default
, always returns a Promise with the action type and the new state value changed by your action.
Dutier has a tiny size (1.5kb), no dependencies, tiny API and it's very easy to get started with React, Vue, Preact, any Frameworks.
Are there any pattern for making api
requests ? like using async
and await
and updating the state like we do in Redux Saga ? @luisvinicius167
It looks great, tiny and relevant ๐ฏ
@piyushchauhan2011 I'll provide some examples with api requests, but I think you can make an api request inside your component and them dispatch an action with response, chaining your dispatch and then update the component state with the new state value, returned by dispatch method. But the fetch will be present inside your component, not in your actions... Thanks!!
Seems like the biggest difference is that dutier is a singleton?
@developit yeah! So, it's because dutier createStore just sets the initialState and the reducers will return new state values and update the current state. With this, you don't need to pass a store instance over your components... Thanks for comment!
Dutier v0.0.3 available now! Thanks folks!