【发布时间】:2018-06-25 15:16:55
【问题描述】:
我试图从数组中输出一个值,但得到错误:array1 is not defined no-undef
代码片段:
constructor() {
super();
this.state = {
array1: [],
}
}
//代码 sn -p componentDidMount:
componentDidMount(props) {
this.setState({array1: [5, 12, 8, 130, 44] })
}
//代码sn-p,函数:
found = this.state.array1.find((element) => {
return element > 10;
});
代码 sn-p:
render(){
console.log(found);
}
箭头函数出现页面错误,请问可以帮忙吗?
【问题讨论】:
标签: javascript reactjs