Linked Questions
55 questions linked to/from Why do we need middleware for async flow in Redux?
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 ...
1
vote
1
answer
686
views
Why developers of Redux use Middleware to handle asynchronous instead of just wait the promise to resolve? [duplicate]
I'm new to Redux, I've seen a lot of people using some Middleware to handle asynchronous.
My question is, I can just do this:
fetch(myAPI)
.then(res => res.json())
.then(res => {
...
0
votes
0
answers
85
views
Why should I use redux async actions? [duplicate]
In my current code base actions are dispatched from a few stateful components or separated "services" that listen for user or both sensor and real world events. This is a react-native application ...
0
votes
0
answers
41
views
Why do we need Redux-Thunk to handle async flow instead of using Promise directly? [duplicate]
I've searched the answers for this question, but the answers are quite vague, and I still don't get it why we need Redux-Thunk instead of Promise to handle async flows.
Please help to take a look at ...
1082
votes
14
answers
534k
views
How to dispatch a Redux action with a timeout?
I have an action that updates the notification state of my application. Usually, this notification will be an error or info of some sort. I need to then dispatch another action after 5 seconds that ...
581
votes
11
answers
137k
views
Pros/cons of using redux-saga with ES6 generators vs redux-thunk with ES2017 async/await
There is a lot of talk about the latest kid in redux town right now, redux-saga/redux-saga. It uses generator functions for listening to/dispatching actions.
Before I wrap my head around it, I would ...
382
votes
11
answers
230k
views
How can I communicate between related react components?
I just got started with ReactJS and am a little stuck on a problem that I have.
My application is essentially a list with filters and a button to change the layout.
At the moment I'm using three ...
47
votes
2
answers
10k
views
How to handle complex side-effects in Redux?
I've been struggling for hours to finding a solution to this problem...
I am developing a game with an online scoreboard. The player can log in and log out at any time. After finishing a game, the ...
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 ...
4
votes
3
answers
10k
views
How to pass Dispatch to action when using redux form
I have the following Search Component
import React, { Component } from 'react';
import { Field, reduxForm } from 'redux-form';
import { search } from '../../actions/actions'
class Search extends ...
10
votes
3
answers
2k
views
Why use Redux Thunk [closed]
Why use Redux Thunk then one can do something like this:
ReadableAPI.getCategories().then((categories)=>{
console.log('after getCategories', categories)
this.props.dispatch(...
8
votes
1
answer
4k
views
What are the benefits of using thunk middleware in redux over using regular functions as async action creators? [closed]
I've been using redux for about two months now and have just recently started getting into exploring different ways of dealing with asynchronous behavior such as fetching data. It appears from the ...
2
votes
2
answers
2k
views
When using redux, why should I avoid doing API calls directly in the component?
So I may be asking the wrong question, so please leave comments and I'll adjust. I was told by another developer that when using redux, I should do ALL API calls within actions and create reducers for ...
6
votes
1
answer
809
views
Redux Thunk vs Making api call in react component
I was wondering if what I've been doing in my ReactNative/Redux application is wrong. This is how I've been handling async actions.
MyComponent.js
componentDidMount() {
fetch('https://www....
2
votes
2
answers
2k
views
Redux Middleware And GraphQL
Ok, As per my understanding we use middleware in redux for all the async calls now from Apollo documentation we can directly use queries and mutation inside our component.
I personally thought that ...