Module: use-inventory
Table of contents
Functions
Functions
useInventory
▸ useInventory<T
>(key
, config?
): SWRResponse
<T
, any
>
A custom hook to retrieve items stored in the inventory store, such as Stable Diffusion configurations, apps, datasets, etc.
Type parameters
Name | Description |
---|---|
T | The type of the data being retrieved from the inventory store. |
Parameters
Name | Type | Description |
---|---|---|
key | string | The key to identify which item to retrieve from the inventory store. |
config? | any | Optional configuration for the SWR hook. |
Returns
SWRResponse
<T
, any
>
- The response object from the SWR hook, containing the data, error, and status of the fetch request.
Function
useInventory
Example
const { data, error } = useInventory<StableDiffusion>('stable-diffusion-config');
if (error) return <div>Error loading inventory</div>;
if (!data) return <div>Loading...</div>;
return (
<div>
<h1>Stable Diffusion Inventory</h1>
<pre>{JSON.stringify(data, null, 2)}</pre>
</div>
);
Defined in
react/dist/esm/use-inventory/index.js:28