useDb
Reads the db of the nearest
DbProvider
. Pass the db's type, as in
useDb<AppDb>()
with
type AppDb = ReturnType<typeof createAppDb>
.
Import
import { useDb } from "@hyper-fetch/react"
Source
Package
Usage
const db = useDb<AppDb>();
const { data } = useLiveQuery(db.post.where((post) => eq(post.teamId, teamId)));
Parameters
useDb<Db>()
Returns
Db
