0

I have a problem on my react app with FireStore database.

Here is my state with a console.log :

Picture of the state project

I have my documents.project array not empty but I have this error on my app :

Picture of the react error

Roshana Pitigala
  • 8,437
  • 8
  • 49
  • 80
TheFugu
  • 3
  • 1

1 Answers1

1

Your documents variable is a array so you either need to loop through the array to get the index value and use it to access all the objects with project property like:

for(var i=0; i<documents.length; i++){
  console.log(documents[i].project);
}

Or you need to explicitly define the index value as documents[0].project to get the project value of object at index 0 and so on.

Ankit Agarwal
  • 30,378
  • 5
  • 37
  • 62