🔥 Firebase Svelte v2

<CollectionGroup>

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 | Query - The collection reference to create the store from. Can be a string, just like posts or a CollectionReference object, using the collection firebase function.
  • 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.
  • refField: string - The field to use for the reference.

Slots & Props

default

The default slot is rendered when data is found.

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

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.