【发布时间】:2020-11-22 18:07:07
【问题描述】:
在我的这个API
我想从推荐的配置中获取值,但有些值为空,所以我的应用程序给了我一个错误:null is not an object
这是我的代码:
let page1 = this.state.dataSource1.map((val, key) => {
// if (val.platforms[0].requirements_en.minimum != null) {
// }
return (
{val.platforms[0].requirements_en.recommended ==! null ?
<Text style={styles.name}>minimal configuration : {val.platforms[0].requirements_en.recommended}</Text>
:
<Text>Nothing</Text>
}
)
})
我想说的是,如果值不为空,请将数据发送给我,否则为简单的文本,但它不起作用...
【问题讨论】:
-
你的意思是
!==? -
它也不起作用。
标签: react-native api mobile null fetch