Skip to content Skip to sidebar Skip to footer

Displaying Data Returned From Firebase On Screen React

I have data being returned from my firebase query, but I cannot figure out how to display on the screen. take a look at this code: firestore.collection('profiledata').doc(userID).g

Solution 1:

You just need to set the data in your state.

firestore.collection('profiledata').doc(userID).get().then(doc => this.setState({ profiledata: doc.data() }))}

and where you map the data you just output the values

return (
  <div>
    <p>First Name: ${profiledata.firstname}</p>
    <p>Last Name: ${profiledata.lastname}</p>
    <p>Company Name: ${profiledata.companyname}</p>
  </div>
)

Post a Comment for "Displaying Data Returned From Firebase On Screen React"