【发布时间】:2018-03-22 04:20:44
【问题描述】:
虽然有一个非常相似的问题: Failed prop type: The prop todos[0].id is marked as required in TodoList, but its value is undefined
看起来只有症状是相同的(我按照建议更正了所有导入)
我可以添加一个待办事项元素,但是当我单击一个元素时,todos 数组不知何故变成了undefined,并且控制台打印出以下错误:
Warning: Failed prop type: The prop `todos[0]` is marked as required in `TodoList`, but its value is `undefined`.
我创建了一个最小的示例存储库,它在以下位置显示了问题: https://github.com/klaszlo/redux-todo-nonworking
((原例:https://github.com/reactjs/redux/tree/master/examples/todos))
重现步骤:
我。安装依赖:
git clone https://github.com/klaszlo/redux-todo-nonworking.git
cd redux-todo-nonworking
npm install
二。构建:
npm run build
三。运行本地服务器:
cd dist && npm run test:server
四。在浏览器中导航到:
http://localhost:8080
V。 BUG重现
- 添加待办事项元素
- 点击它(并观看 javascript 输出)
【问题讨论】:
标签: javascript reactjs redux