What's the need of defining this statement like this in next-redux-wrapper makeStore: (store as SagaStore).sagaTask
, instead of simply declaring sagaMiddleware.run(rootSaga);
.
export const makeStore = (context) => {
...
(store as SagaStore).sagaTask = sagaMiddleware.run(rootSaga);
return store; };
Also, in individual pages, why do I need to declare this statement: await store.sagaTask.toPromise()
:
export const getStaticProps = wrapper.getStaticProps(async ({ store }) => {
...
await store.sagaTask.toPromise()
})