在NextJs中调度会产生错误

时间:2020-11-12 18:17:18

标签: next.js

我想使用以下代码在下一个js中进行调度:

export const getServerSideProps = wrapper.getServerSideProps(async ({ store, req, res }) => {

  store.dispatch(carsRequest('data'));
  store.dispatch(END);
  await store.sagaTask.toPromise();

});

Server Error
Error: Error serializing `.initialState.carReducer.cars` returned from `getServerSideProps` in "/cars".
Reason: `undefined` cannot be serialized as JSON. Please use `null` or omit this value all together.

为什么会出现此错误以及如何解决?

0 个答案:

没有答案