TypeError: undefined不是对象(评价'_ref.state')

问题描述 投票:0回答:1

我正在尝试用Redux、Saga和React Navigation配置React Native。

很抱歉,我必须创建一个要点,因为代码格式不允许我在这里粘贴所有代码。

我的代码要点链接

我越来越

TypeError: undefined is not an object(evalating '_ref.state) showReducers.js:13:15

我正在使用 expo-client 到React Native应用开发,并使用Redux、Redux-Saga和Redux-Persist进行商店持久化。

我无法前进

react-native react-redux expo react-navigation redux-saga
1个回答
1
投票

它看起来像 initialState 中没有定义 showReducer.js因此,默认值为 state 设置为 undefined 这里。

export default ({ state = initalState, action })...

所以当你使用传播操作符时

return {
     ...state,
     isCreateScrapbookModal: true
}

你正试图评估一个对象 statestate 其实 undefined所以你得到了这个错误。

© www.soinside.com 2019 - 2024. All rights reserved.