Home How to dispatch multiple redux store actions using ES6 Promise?
Reply: 0

How to dispatch multiple redux store actions using ES6 Promise?

Gasim
1#
Gasim Published in 2017-01-27 14:18:45Z

I am trying to dispatch multiple redux actions in a sequence (or at once, doesn't really matter) using Promise API and it is not working:

Promise.all([
    store.dispatch(action1()),
    store.dispatch(action2()),
    store.dispatch(action3()),
    store.dispatch(action4())
]).then(() => {
    res.send(renderToString(<Provider store={store}><App /></Provider>));
});

I keep getting the following error:

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'map' of null

What am I doing wrong?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.367958 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO