您好,欢迎来到好走旅游网。
搜索
您的当前位置:首页Cannot read property map of undefined

Cannot read property map of undefined

来源:好走旅游网

原代码:

报错信息:

TypeError: Cannot read property 'map' of undefined

ListUi.render

src/Demo1/listUI.jsx:13

  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。

 

修改之后

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- haog.cn 版权所有

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务