分配后状态为null

时间:2018-08-04 08:09:56

标签: react-native redux react-redux

我在我的React本机项目中使用redux,并且在分派某事时收到此错误。

错误:

  

TaskQueue:任务发生错误:不变违规:不变违规:不变违规:试图获取超出范围索引NaN的帧

我想说的其他信息是,我的导航已将第一个屏幕连接到*那个列表,第二个屏幕连接到* room_Messages

我的减速机:

case 'RECEIVE_MESSAGE':
        {
            index=0;
            msg = JSON.parse(action.msg)


            msgItem = {
                id: Math.random(),
                message: msg.message
            }

            return {...state,
                chatList: {
                    ...state.chatList  
                    , [0]: {
                        ...state.chatList[0], room_messages: {
                            ...state.chatList[0].room_messages.slice(0)
                        }
                    }
                },
            }

当我导航到第二个屏幕然后调度RECEIVE_MESSAGE操作时,在第一个屏幕中,我的道具为null(我在第一个屏幕的componentDidUpdate中注意到了这一点)

0 个答案:

没有答案