ConstType of the stored value
OptionalinitialValue: TOptional starting value
Configuration
OptionalalwaysRecall?: booleanIf true, every .set() triggers refresh (default: false)
Read-only state handle with .get(), .set(newValue, {recall?}), .add(delta, {recall?}), .lastChanged
Returns a stateful value wrapper with
.get(),.set(),.add()(for numbers), etc.This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks. The call order of all hooks is strictly fixed across every refresh; reordering calls will corrupt internal state.
Critical performance warning: Frequent
.set()calls (especially insideuseTick/usePaint) cause full component refresh → expensive re-execution, hook re-binding, child reconciliation. Do NOT useuseStatefor position, velocity, timers, counters, health deltas, etc. → UseuseSelforuseReffor hot loop data. → ReserveuseStatefor infrequent structural changes (isDead, levelUp, gameOver, variant change → spawn different children).