I am trying to react all items from a collection in Firebase into an array so I can use later in React.
I have this currently:
const retrievegear = firebase.firestore().collection('gear').get().then(querySnapshot => {
querySnapshot.forEach(doc => {
const check = doc.data().Name;
console.log(check);
});
});
Which is fine - it shows me all the Names of the items in the gear collection. But I want it within an array and only want some of the fields in the collection.
I am then using this array to populate checkboxes - so I need const declared somewhere so that my return can access it.