🔥 Firebase Svelte v2

<Collection>

Props

  • firestore?: Firestore - The firebase firestore instance, optional if you put the <FirebaseApp> component at the root of your app, or higher than where you're using this component.
  • ref: string | CollectionReference<Data[]> - The collection reference to create the store from. Can be a string, just like posts or a CollectionReference object, using the collection firebase function.
  • queryConstraints: QueryConstraint[] - An array of query constraints to apply to the collection reference.
  • startValue?: Data[] - The initial value of the store. This is useful if you want to avoid a loading state. The `Data` type is inferred from what data you give it and used for the CollectionReference too.
  • log: boolean = false - If true, the store will log additional information to the console.
  • once: boolean = false - If true, the store will only fetch the data once, and will not update when the data changes.

Slots & Props

default

The default slot is rendered when data is found.

  • data: Data[] - The data object from firestore.
  • ref: CollectionReference<Data[]> | null - The collection reference you gave.
  • count: number - The number of documents in the collection.
  • error: Error | null - Error if any.
  • first: Data | null - The first document in the collection.
  • last: Data | null - The last document in the collection.

loading

The loading slot. This is rendered while the data is fetching.

fallback

The fallback slot. This is rendered when the data is not found.