Advertisement
anhhtz

Untitled

Oct 4th, 2018
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. onCollectionUpdate = (querySnapshot) => {
  2.   const todos = [];
  3.   querySnapshot.forEach((doc) => {
  4.     const { title, complete } = doc.data();
  5.     todos.push({
  6.       key: doc.id,
  7.       doc, // DocumentSnapshot
  8.       title,
  9.       complete,
  10.     });
  11.   });
  12.   this.setState({
  13.     todos,
  14.     loading: false,
  15.  });
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement