Answer the question
In order to leave comments, you need to log in
How to chain requests in React + Redux?
It is necessary to implement such a chain of asynchronous requests
Download Facebook SDK asynchronously -> Check if the user is authorized -> If authorized, get additional information on it
FbActions is responsible for asynchronous loading of the SDK, UserActions is responsible for authorizing the user and receiving data on him
The question is: how these actions combine? return promises and write a chain at the container level:
sdkLoading.then -> checkUserStatus.then -> getUserDetails
or is this not done at the component container level - is it better to take it to the FbActions level and import the necessary calls from UserActions there?
Answer the question
In order to leave comments, you need to log in
Like, found a variant with thunk
It can dispatch function calls. It turned out something like:
fb.initCore().then(
() => {
dispatch({
type: FB_LOADED_SUCCESS,
});
dispatch(getUserStatus());
},
() => {
dispatch({
type: FB_LOADED_FAIL,
});
},
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question