Why do we have to use thunk sagas etc to hanlde async state chnages in React. Was it an after tought to Redux. VueX seems to handles these things well without additional middlewares.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (3)
That's because Redux has a very simple implementation, and it is actually unaware of React, you have to bring
react-redux
for them to work together. Middlewares are necessary to add features that Redux doesn't have out the box.Actions
in Redux are merely a convention, it is the recomended way of doing thing but are not necesary, the same goes for theswitch
statement in a reducer.Vuex on the other hand is more complex in its implementation and it was made specifically to work with Vue.
Actions
are an integral part of Vuex and already provide you with features that you could find inredux-thunk
.True. That kind of makes sense. I forgot that Redux isn't intended just for React. Do you think context API helps in this case since it's React specific.
Thanks.
Yes, it does help. React has added features in the core library that now help with state management and side effects. If you want to know more this article is a good start: Application State Management with React.