Cannot read property map of undefined
2020-07-14 05:49
549 查看
原代码:
报错信息:
TypeError: Cannot read property 'map' of undefined
ListUi.render
src/Demo1/listUI.jsx:13
[code] 10 | {/* ref={input => this.input = input} */} 11 | <input value={this.props.inpValue} onChange={this.props.changeValue} /> 12 | <button onClick={this.props.addValue}>增加</button> > 13 | <ul> | ^ 14 | { 15 | this.props.list.map((item,index)=>{ 16 | return (
View compiled
原因:调用map的对象是 undefined,初始化第一次渲染的时候异步数据返回之前list是undefined。
修改之后
相关文章推荐
- vue Uncaught TypeError: Cannot read property 'gc' of undefined
- "TypeError: Cannot read property 'undefined' of undefined"
- 使用form的方法(例如:reset,clear等)报错Uncaught TypeError: Cannot read property 'tip' of undefined(…)的原因
- TypeError: Cannot read property 'newLine' of undefined
- TypeError: Cannot read property 'url' of undefined
- 关于easyui获取c#后台数据报错 Cannot read property 'length' of undefined的问题
- 【新手坑】Cannot read property 'join' of undefined
- 在js中设置cssText样式,关于Cannotreadpropertystyleofundefinedjs报错
- js的form(load报错jquery.easyui.min.js:2837 Uncaught TypeError: Cannot read property 'tip' of undefined
- js提示Cannot read property 'style' of undefined
- javascript Uncaught TypeError: Cannot read property ... of undefined
- vuejs路由使用的问题Error in render function: "TypeError: Cannot read property 'matched' of undefined"
- vue 国际化在弹出框中$t()报错:TypeError: Cannot read property '_t' of undefined
- 浏览器报Uncaught TypeError: Cannot read property 'trigger' of undefined解决方案
- angular-cli启动问题——TypeError: Cannot read property 'newLine' of undefined
- vue项目中Error in render function: "TypeError: Cannot read property 'matched' of undefined"
- Uncaught TypeError: Cannot read property 'trigger' of undefined(zepto.js)
- vue:error Cannot read property 'length' of undefined
- Uncaught TypeError: Cannot read property 'msie' of undefined
- uploadify的JS组件报错:Uncaught TypeError: Cannot read property 'queueData' of undefined