APIContextinterface

{
	useAPI<PP extends P, RR extends R>(this: void, endpoint: Endpoint<PP, RR>, payload: PP): EndpointStore<PP, RR>;
	useAPI<PP extends P, RR extends R>(this: void, endpoint: Nullish<Endpoint<PP, RR>>, payload: PP): EndpointStore<PP, RR> | undefined;
	readonly APIContext: (props: ChildProps) => ReactElement;
	requireAPICache(): APICache<P, R>;
}
PropertyType
.APIContext(props: ChildProps) => ReactElement
Create a new APICache and provide it as context to child nodes, to allow them to use useAPI() required readonly

Bundle of hooks and a provider component returned by createAPIContext()

Methods

Go

APIContext.useAPI()method

React hook to return an EndpointStore for the specified endpoint/payload in the current APIProvider context.

useAPI(this: void, endpoint: Endpoint<PP, RR>, payload: PP): EndpointStore<PP, RR>
useAPI(this: void, endpoint: Nullish<Endpoint<PP, RR>>, payload: PP): EndpointStore<PP, RR> | undefined
Go

APIContext.requireAPICache()method

Return the underlying APICache for <APIContext>

requireAPICache(): APICache<P, R>