Skip to content

Documentation / @agentick/core / useOnTickStart

Function: useOnTickStart()

useOnTickStart(callback): void

Defined in: core/src/hooks/lifecycle.ts:86

Register a callback to run at the start of each tick.

Timing: Fires on every tick the component is alive, including the tick in which it mounts. Newly-mounted components receive a catch-up call after their first render.

Parameters

callback

TickStartCallback

Returns

void

Example

tsx
useOnTickStart((tickState) => {
  console.log(`Tick ${tickState.tick} starting!`);
});

useOnTickStart((tickState, ctx) => {
  ctx.setState("lastTickStart", tickState.tick);
});

Released under the ISC License.