DBContextinterface

{
	useItem<II extends I, TT extends T>(
		collection: Nullish<Collection<string, II, TT>>, //
		id: Nullish<II>,
	): ItemStore<II, TT> | undefined;
	useItem<II extends I, TT extends T>(
		collection: Collection<string, II, TT>, //
		id: II,
	): ItemStore<II, TT>;
	useQuery<II extends I, TT extends T>(
		collection: Nullish<Collection<string, II, TT>>, //
		query: Nullish<Query<Item<II, TT>>>,
	): QueryStore<II, TT> | undefined;
	useQuery<II extends I, TT extends T>(
		collection: Collection<string, II, TT>, //
		query: Query<Item<II, TT>>,
	): QueryStore<II, TT>;
	readonly DBContext: ({ children }: { children: ReactNode }) => ReactElement;
	requireDBCache(): DBCache<I, T>;
}
PropertyType
.DBContext({ children }: { children: ReactNode }) => ReactElement
Create a new DBCache and provide it as context to child nodes, to allow them to use useItem() and useQuery() required readonly

Bundle of hooks and a provider component returned by createDBContext().

Methods

Go

DBContext.useItem()method

Get an ItemStore for the specified collection item in the current DataProvider context and subscribe to any changes in it.

useItem(collection: Nullish<Collection<string, II, TT>>, id: Nullish<II>): ItemStore<II, TT> | undefined
useItem(collection: Collection<string, II, TT>, id: II): ItemStore<II, TT>
Go

DBContext.useQuery()method

Get an QueryStore for the specified collection query in the current DataProvider context and subscribe to any changes in it.

useQuery(collection: Nullish<Collection<string, II, TT>>, query: Nullish<Query<Item<II, TT>>>): QueryStore<II, TT> | undefined
useQuery(collection: Collection<string, II, TT>, query: Query<Item<II, TT>>): QueryStore<II, TT>
Go

DBContext.requireDBCache()method

Return the underlying DBCache for <DBContext>

requireDBCache(): DBCache<I, T>