Skip to main content

Function: useDB()

useDB<US>(): GoatDB<US>

Defined in: react/hooks.ts:33

Opens a local DB, creating it if necessary. Once opened, the DB is available as a react context. All future calls return the already opened DB rather than opening it again.

This hook will trigger a re-render whenever the current user changes.

Type Parameters

Type Parameter
US extends Schema

Returns

GoatDB<US>

A DB instance.