Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sanchedev/tiny-engine/llms.txt
Use this file to discover all available pages before exploring further.
useEffect registers a side-effect function that is re-run whenever any signal read inside the function changes. The effect does not run immediately at component setup time; it runs for the first time when the component’s root node starts, and re-runs on every subsequent change to a tracked signal. An optional cleanup function returned from fn is called before the next run and when the node is destroyed.
Signature
Parameters
The effect function. Any
SignalGetter called inside it becomes a tracked dependency. The function can optionally return a cleanup callback that is invoked before the effect re-runs or when the node is destroyed.Return value
void — useEffect does not return a value.
Examples
Logging health changes
Player.tsx
Syncing external state
ScoreDisplay.tsx
Multiple tracked signals
StatusHUD.tsx
Unlike React’s
useEffect, tiny-engine’s useEffect does not run on initial mount. It runs reactively: the first execution happens when the node’s started event fires (not when the component function is called), and subsequent executions happen only when a tracked signal changes. There is no dependency array — tracking is automatic and dynamic.