Skip to content

Profectus / data/common / setupSelectable

Function: setupSelectable() ​

setupSelectable<T>(): object

Utility function for setting up a system where one of many things can be selected. It's recommended to use an ID or index rather than the object itself, so that you can wrap the ref in a persistent without breaking anything.

Type Parameters ​

• T

Returns ​

object

The ref containing the selection, as well as a select and deselect function

deselect() ​

deselect: () => void

Returns ​

void

select() ​

select: (node) => void

Parameters ​

node ​

T

Returns ​

void

selected ​

selected: Ref<undefined | T, undefined | T>

Defined in ​

profectus/src/data/common.tsx:509