Linked Questions
60 questions linked to/from How to dispatch a Redux action with a timeout?
0 votes
1 answer
88 views
Function parameter explanation in Redux where a function returns a function? [duplicate]
I do understand Redux a bit, but I don't understand how you can put a function inside a function. import api from '../utils/api'; import { GET_PROFILE, PROFILE_ERROR } from './types'; export const ...
912 votes
13 answers
227k views
Why do we need middleware for async flow in Redux?
According to the docs, "Without middleware, Redux store only supports synchronous data flow". I don't understand why this is the case. Why can't the container component call the async API, and then ...
370 votes
8 answers
228k views
Accessing Redux state in an action creator?
Say I have the following: export const SOME_ACTION = 'SOME_ACTION'; export function someAction() { return { type: SOME_ACTION, } } And in that action creator, I want to access the global ...
280 votes
7 answers
209k views
Can I dispatch an action in reducer?
is it possible to dispatch an action in a reducer itself? I have a progressbar and an audio element. The goal is to update the progressbar when the time gets updated in the audio element. But I don't ...
160 votes
2 answers
89k views
Is store.dispatch in Redux synchronous or asynchronous
I realize this is a basic question but I had no luck finding the answer elsewhere. Is store.dispatch synchronous or asynchronous in Redux ? In case it is asynchronous is there a possibility to add a ...
28 votes
3 answers
20k views
Can I dispatch multiple actions without Redux Thunk middleware?
I read that Redux Thunk is the reliable way to manage asynchronous actions/request. There's nothing much about dispatching actions by other actions. How about dispatching synchronous actions? I am ...
29 votes
3 answers
29k views
React Redux - Is adding async method in a Reducer an anti pattern?
I'm pretty new to the whole react-native / redux world, so maybe this question will sound dumb :) I know that for an API call, or stuff like that, the convention is to use middleware, but is it ...
19 votes
2 answers
21k views
How to handle errors in fetch() responses with Redux Thunk?
I'm making API requests using isomorphic fetch, and using Redux to handle my app's state. I want to handle both internet connection loss errors, and API errors, by firing off Redux actions. I have ...
19 votes
2 answers
5k views
Can I send an AJAX call in React and Redux without action creators and reducers?
I have a few ajax requests that are not directly manipulating my apps state. In a react/redux application is it necessary (or is there any benefit) to dispatch an action for these ajax requests ...
38 votes
1 answer
23k views
Why use redux-thunk? [duplicate]
I don't understand the need for something like redux-thunk. From what I understand a thunk is a function which returns a function. The wrapped expressions and the use of middleware appear to me to do ...
16 votes
1 answer
4k views
What are the differences between Redux-Thunk and Redux-Promise when used with Axios apis?
I have been using React , Redux since few months now. One of the most confusing part of the ecosystem is the async data flow. There are many great solutions available and choosing the right solution ...
8 votes
5 answers
16k views
React-redux : listening to state changes to trigger action
I have my redux state like this: { parks: [ { _id:"ad1esdad", fullName : "Some Name" }, { _id:"ad1es3s", fullName : "Some Name2" } ], parkInfo: { id ...
2 votes
4 answers
8k views
How do I get access to the global state in mapDispatchToProps in redux?
I want to dispatch an action to update my application's global state with the currently signed in user. When a user clicks a button, an event handler fires that is registered in mapDispatchToProps, ...
1 vote
1 answer
12k views
react, redux chain a next dispatch
I'm still beginning in react and redux and now I followed this tutorial and it uses this middleware for dispatch. I was wondering how I would do another dispatch after the first one (to chain it)? I ...
4 votes
2 answers
3k views
How to delay redux state changes to allow for a side effect in a react component
Sorry for the kind of vague title. The best way to explain my question might be an example. I have a of items in redux, and the list is displayed in a react component using standard react-redux ...