1681-engine / react / usePicked
Function: usePicked() ​
ts
function usePicked<T>(
items,
key,
auto?
): [T | null, (id) => void];Defined in: src/react/usePicked.ts:8
Which entry of a list is picked for a SplitPane's detail, by key. While nothing is picked — or the picked entry is gone (sold, used up) — the first one stands in, so the detail is never empty while the list is not; auto: false leaves it empty instead (a letter must not be opened, and so marked read, without the player choosing it).
Type Parameters ​
| Type Parameter |
|---|
T |
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
items | readonly T[] | undefined |
key | (item) => string | undefined |
auto | boolean | true |
Returns ​
[T | null, (id) => void]