How to get desired object within an object from firestore in react table

Viewed 36

this is the database pic of my cloud firestore> add data to firestore from react

    const userRef = db.collection("students").add({
basicData{
name:this.state.name,
age:this.state.age,
class:this.state.class
},
addressData{
street:this.state.street,
taluk:this.state.taluk,
district:this.state.district
}
});

retrieve data from firestore in react

const studentsSnapshot=[];
db.collection("/students")
      .get()
      .then((snapshot) => {
        snapshot.docs.forEach((doc) => {
          studentsSnapshot.push(doc.data());
          this.setState({ students: studentsSnapshot });
          console.log(this.state.criminals[0].basicData);
        });
      });

From this i need only basicData of students aand i need to show it in react table so please help me how to do it. I tried every other way from firestore documentation but it didn't help me... Please somebody. and also please show me how to show the data in table

0 Answers
Related