axios all example in react
Example: axios multiple request
// set requests
const reqOne = axios.get(endpoint);
const reqTwo = axios.get(endpoint);
axios.all([reqOne, reqTwo]).then(axios.spread((...responses) => {
const responseOne = responses[0]
const responseTwo = responses[1]
})).catch(errors => {
// react on errors.
})