How to use the reactfire.useFirestoreCollection function in reactfire

To help you get started, we’ve selected a few reactfire examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FirebaseExtended / reactfire / sample-complex / src / FirestoreAnimals.tsx View on Github external
const Animals = ({ serverAnimals }) => {
  let initialAnimals = deserialize(serverAnimals);

  let animals = initialAnimals;

  if (firebase.apps.length) {
    animals = useFirestoreCollection(
      firebase.firestore().collection('animals'),
      { startWithValue: initialAnimals }
    );
  }

  return (
    <ul>
      {animals.docs.map(animal =&gt; (
        <li>name: {animal.data().commonName}</li>
      ))}
    </ul>
  );
};