Reducer "index" returned undefined during initialization.

发布于 2022-09-11 18:44:44 字数 846 浏览 21 评论 0

clipboard.png

clipboard.png

ant design项目 启动报错

相关代码

// 请把代码文本粘贴到下方(请勿用图片代替代码)

Error: Reducer "index" 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.
The above error occurred in the <DvaContainer> component:
    in DvaContainer

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白云悠悠 2022-09-18 18:44:44

reducer的函数参数中给state赋一个初值,即state={}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文