【发布时间】:2020-06-08 00:27:27
【问题描述】:
我是 react native 的初学者。我使用 Firebase,我想检索子 TorchesMigRefroidiesAir 以显示它包含的内容。
当我创建console.log() 时,它会显示null。我不明白怎么做。请问你能帮帮我吗 ?谢谢。
componentDidMount() {
const ref = firebase.database().ref('PostesMig').child('TorchesMigRefroidiesAir')
ref.on('value', snapshot => {
this.setState({
postes : snapshot.val(),
loading: false
})
})
}
我的 json :
{
"PostesMig": [
{
"CodeCommun": "6460669",
"RefFournisseur": "KFM1170001",
"DesignationAS400": "MINARCMIG EVO 170 T3M COMPLET",
"TorchesMigRefroidiesAir": [
{
"CodeCommun": "6460754",
"RefFournisseur": "6250220",
"DesignationAS400": "TORCHE MIG KEMPPI MMG 22 3M"
}
]
},
{
"CodeCommun": "6460670",
"RefFournisseur": "KFM1200001",
"DesignationAS400": "MINARCMIG EVO 200 T3M COMPLET",
"TorchesMigRefroidiesAir": [
{
"CodeCommun": "6460754",
"RefFournisseur": "6250220",
"DesignationAS400": "TORCHE MIG KEMPPI MMG 22 3M"
},
{
"CodeCommun": "6460742",
"RefFournisseur": "102P721030",
"DesignationAS400": "TORCHE MIG TBI 150 3M EXPERT"
}
]
},
我的 Firebase 数据库图片:
【问题讨论】:
标签: javascript reactjs firebase react-native firebase-realtime-database