Doc
The Doc
component is a wrapper around the docStore
. It renders the document data and handles the loading state.
Props
ref
- A Firestore document reference or path string (e.g.posts/hi-mom
)startWith
- (optional) initial value to use before the document is fetched
Slots
default
- The document dataloading
- Loading state
Slot Props
data
- The document dataref
- The Firestore document referencefirestore
- The Firestore instance
Example
<script>
import { Doc } from 'sveltefire';
</script>
<Doc ref={'posts/id'} let:data>
<p>{data?.title}</p>
<p slot="loading">Loading...</p>
</Doc>