useBehaviour
useBehaviour<
T>(behaviour,value):void
Defined in: packages/engine/src/components/useBehaviour.ts:20
The one hook a behaviour is built from: adds the trait to the nearest Entity on mount, sets it when the value changes, removes it on unmount. An entity a system destroyed first is left alone. The behaviour is a leaf of its entity in the devtools tree, under the calling component’s name with the value as its props.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends Trait |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
behaviour |
Behaviour<T> |
value |
BehaviourValue<T> |
Returns
Section titled “Returns”void