Skip to main content
Version: v10.0.0

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"

Usage​

const db = useDb<AppDb>();
const { data } = useLiveQuery(db.post.where((post) => eq(post.teamId, teamId)));

Parameters​

useDb<Db>()

Returns​

Db