score:1

Accepted answer
const [items, setItems] = useState();
useEffect(() => {
  let data = [];
  firebase
    .firestore()
    .collection("items")
    .onSnapshot((snapshot) => {
      let changes = snapshot.docChanges();
      console.log(changes);
      changes.forEach((change) => {
        data.push(change.doc.data());
      });
// spreading the data here did solve my problem
      setItems([...data]);
    });
}, []);


Related Query

More Query from same tag