Hello guys my code is similar to this https://github.com/vercel/next.js/tree/canary/examples/with-redux-saga .
However, when I try to do this code:
export const getStaticProps = wrapper.getStaticProps(async ({ store }) => {
store.dispatch(initCategoriesRequest());
store.dispatch(END);
await store.sagaTask.toPromise();
});
It says:
Error: Actions must be plain objects. Use custom middleware for async actions.
and it points to store.dispatch(END)
.
Also, if i put async (ctx)
instead of async ({ store })
, I don't get any paramters (for example req
, res
, params
, etc.) for ctx
; there's only the store.
Maybe the problem is something with the configuration.
Late response, but you must import the END action from redux-saga.
eg
import { END } from 'redux-saga';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.