reading-notes


Project maintained by mr-atta Hosted on GitHub Pages — Theme by mattgraham

Redux - Asynchronous Actions



How granular should your reducers be ❓ 📁

Reducer functions should only depend on their state and action arguments, … subscribed to the Redux store and reading data at a more granular level.

Pro or Con – multiple reducers can “fire” when a commonly named action is dispatched❓ 📁

Pro or Con – multiple reducers can “fire” when a commonly named action is dispatched Well, it is a Pro more than a Con since we have to change multiple states in multiple components, the fact that all the reducers can listen when the action is dispatched can reduce a lot of work, each reducer can provide a different logic to the same dispatcher.

Name a strategy for preventing the above❓ 📁

Make a reducer for each component that will be affected by the dispatcher



Redux

Redux


Redux Thunk

Redux Thunk is a middleware that lets you call action creators that return a function instead of an action object. That function receives the store’s dispatch method, which is then used to dispatch regular synchronous actions inside the function’s body once the asynchronous operations have been completed.

Redux

📌 async actions

📌 thunk middleware

📌 redux thunk