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;
}
PropertyType
.DBContext({ children }: { children: ReactNode }) => ReactElement
The <DataContext> wrapper to give your React components access to this data. 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>