javascript - Firebase: snap.child(...).once is not a function -
i want listen data firebase first have check if keys leading specific data has been made. if have not yet been made there no problem don't have listen.
i error message:
snip.child(...).once not function
i have tried followed documentation here seems if doing should legal.
the .haschild(...)
works fine.
rootref.child('match-feed-comments').once('value', snip => { if (snip.haschild(this.props.matchid)) { // checking if child exists snip.child(this.props.matchid).once('value', snup => { // if child exists listen if (snup.haschild(this.props.feedcomponentid)) { snup.child(this.props.feedcomponentid).on('value', snap => { // want stuff data this.setstate({ comments: snap.val() }) }); } }); } });
Comments
Post a Comment