redux的错误突然

时间:2018-04-20 21:51:39

标签: javascript reactjs redux

我有几个小时的奇怪错误,真的无法弄清楚它是什么。该应用程序工作正常,然后在我更改了页面标题的名称后给了我这个错误。

TypeError:null不是对象(评估'todo._id')

此错误位于:

in TodoList (created by Connect(TodoList))
in Connect(TodoList) (at NavigatorIOS.ios.js:862)
in RCTNavItem (at NavigatorIOS.ios.js:854)
in StaticContainer (at NavigatorIOS.ios.js:853)
in RCTNavigator (at NavigatorIOS.ios.js:52)
in NavigatorTransitionerIOS (at NavigatorIOS.ios.js:882)
in StaticContainer (at NavigatorIOS.ios.js:881)
in RCTView (at View.js:78)
in View (at NavigatorIOS.ios.js:917)
in NavigatorIOS (at Main.js:26)
in Main (at App.js:25)
in RCTView (at View.js:78)
in View (at App.js:34)
in App (created by Connect(App))
in Connect(App) (at App.js:12)
in Provider (at App.js:11)
in todoListAuth (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:35)
in RCTView (at View.js:78)
in View (at AppContainer.js:102)
in RCTView (at View.js:78)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:34)
  • app / components / TodoList.js:74:30 in
  • app / components / TodoList.js:在renderTodos中使用72:34
  • app / components / TodoList.js:99:11 TodoList_render
  • 在finishClassComponent中的node_modules / react-native / Libraries / Renderer / ReactNativeRenderer-dev.js:8707:21
  • node_modules / react-native / Libraries / Renderer / ReactNativeRenderer-dev.js:11771:25 in performUnitOfWork
  • ...来自框架内部的22个堆栈框架

从那时起,我试图以某种方式修复它甚至从昨天获得回购,但同样的事情却没有改变一切。那是REDx包的东西吗?

由于

修改

代码我已经改变了

<View style={styles.container}>
    <View style={styles.topBar}>
      <TouchableOpacity onPress={this.onBack}>
        <Icon name="chevron-left" size={20} color="white"/>
      </TouchableOpacity>
      <Text style={styles.title}>
        New To-Do // This is the text I've changed
      </Text>
      <TouchableOpacity onPress={this.addNewTodo}>
        <Icon name="check" size={20} color="white"/>
      </TouchableOpacity>
    </View>

错误行

var renderTodos = () => {
  return this.props.todos.map((todo) => { // Line 72
    return (
      <TodoItem key={todo._id} text={todo.text} id={todo._id}/> // Line 74
    )
  })
}
{renderTodos()} // Line 99

0 个答案:

没有答案