Collection
The Collection component is a wrapper around the collectionStore. It renders the collection data and handles the loading state.
Props
ref- A Firestore collection reference, query reference, or path string (e.g.posts)startWith- (optional) initial value to use before the collection is fetched
Slots
default- The collection dataloading- Loading state
Slot Props
data- An array of document dataref- The Firestore collection referencefirestore- The Firestore instancecount- The number of documents returned by the query
Example
<script>
import { Collection } from 'sveltefire';
</script>
<Collection ref={'posts'} let:data let:count>
<p>Found {count} posts</p>
{#each data as post}
<p>{post.title}</p>
{/each}
<p slot="loading">Loading...</p>
</Collection>