[英]state null error using es6 computed state in react
I have this in my jsx 我的jsx中有这个
<tr>
{!isEmpty(content) && content.map(o => {
if(o.sortKey){ console.log(this.state[`order${o.sortKey}`]) }
})}
</tr>
I couldn't run the app, When I commented the console.log line and do this instead console.log(this.state); console.log(o.sortKey)
我无法运行该应用程序,当我注释了console.log行并执行此操作时,改为
console.log(this.state); console.log(o.sortKey)
console.log(this.state); console.log(o.sortKey)
, I have {ordercreated_at:'asc'}
and created_at
but why my computed state has null error? console.log(this.state); console.log(o.sortKey)
,我有{ordercreated_at:'asc'}
和created_at
但是为什么我的计算状态{ordercreated_at:'asc'}
错误?
content.map (o => { return (<span></span>)})
here in map method return something and error will go away. 在map方法中返回错误,错误将消失。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.