1

This is a basic question, so I apologize in advance. I am new to react js with firebase. I do not know how to return the data from firebase fetch query. I tried as much as I could but I could not. I have taken the data from firebase but I can not return it back.

This is my component render section.I tried something like this:

render(){
    const handleGetLikesCount = (eventId) => {
        firebase.database().ref("likes").orderByChild('eventId').equalTo(eventId).once('value', function(snap) {
            return snap.numChildren();
        });
    }

    return (
        <div>
            {handleGetLikesCount(eventId)}
        </div>

    )
}

...but it doesn't work. Any ideas?

I need to be like this

enter image description here

0 Answers0