You need to have access to store or at least its dispatch method to do this. Without that here are two options I can suggest: the easy one is redux-thunk, and more powerful one is redux-saga.
How did you import your store?
I use the createStore method and in index.js I have
const store = configureStore(); [file with createStore]
And I've seen on stackOverflow it's bad practice to export it from there.
Raphael Baum
Sorry for the silence I don't use this social network much.
I usually create a file configureStore.ts where I export same name function. I use this function both on the client and the server passing default state to it if needed.
Sergei
Learning ...
You need to have access to
storeor at least itsdispatchmethod to do this. Without that here are two options I can suggest: the easy one isredux-thunk, and more powerful one isredux-saga.