Appearance
Function: useComputedItems()
ts
function useComputedItems<T>(
items:
| T[]
| (params: {
data: Record<string, unknown>;
value: any;
}) => T[] | Promise<T[]>
| undefined,
state: Record<string, unknown>,
stateValue: any): T[] | undefined;Defined in: src/UI/hooks/useComputedItems.ts:14
Hook to compute items from either a static array or a dynamic function. Prevents infinite render loops by:
- Storing the items function in a ref (avoids re-triggers on function reference changes)
- Using JSON.stringify signatures for stable dependencies (only re-evaluates when data actually changes)
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
items | | T[] | (params: { data: Record<string, unknown>; value: any; }) => T[] | Promise<T[]> | undefined | Static array or function that returns array of items |
state | Record<string, unknown> | The global UI state object |
stateValue | any | The current field value (derived from state[name]) |
Returns
T[] | undefined
The computed items array or undefined