Skip to content

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 ​

ParameterTypeDefault value
itemsreadonly T[]undefined
key(item) => stringundefined
autobooleantrue

Returns ​

[T | null, (id) => void]

Released under the MIT License.