error: The slice reducer for key "recommend" 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.
DVA项目中,引入model文件时,其中一个model的命名空间为router,会报以上错误,可以试着把namespace改了一下就可以了
另外一种情况,model中只有namespace,也会报这个错,可以加上state:{}
models/router.js
export default {
- namespace:'router',
+ namespace:'modelRouter',
+ state:{},
...
} as Model