别人做的 web app ,他本地运行没问题, 给我源代码后,我进行 yarn install ,yarn build 之后再 yarn start ,浏览器打开时报错, 错误报于 redux ,请问这是什么问题?
Error: The slice reducer for key "session" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.
发不了包含全部 error stack 的截图,只能粘贴几个关键点了:基本就是 umi 和 dva 代码和 redux 之间的问题。
_DvaContainer.render
./src/.umi/plugin-dva/dva.ts:83
80 | render() {
81 | let app = getApp();
82 | app.router(() => this.props.children);
> 83 | return app.start()();
84 | }
85 | }
86 |
initialValue
./src/.umi/umi.ts:30
27 | defaultTitle: ``,
28 | },
29 | });
> 30 | return renderClient(opts);
31 | },
32 | args,
33 | });
./src/.umi/umi.ts
./src/.umi/umi.ts:36
33 | });
34 |
35 | const clientRender = getClientRender();
> 36 | export default clientRender();
37 |
38 |
39 | window.g_umi = {