小编nyx*_*nyx的帖子

减速器给出了传播不可迭代实例的无效尝试

想知道我的代码出了什么问题,当我尝试使用 redux 分派操作时,它给出了错误,这是我的 reducer.js 代码

import {UPDATE_LOGIN} from './constants'

const initialState = {
    isLogged:false
};

const reducer = (state = initialState, action) => {
    switch (action.type) {
        case UPDATE_LOGIN:
          return [
            ...state,
            {
              isLogged:action.isLogged
            }
          ];
        default:
          return state;
      }
}
export default reducer;
Run Code Online (Sandbox Code Playgroud)

it gives a Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a Symbol.iterator method.

react-native redux react-redux

2
推荐指数
1
解决办法
862
查看次数

标签 统计

react-native ×1

react-redux ×1

redux ×1