Skip to content

useReaction

Read as Markdown

useReaction(setup, dependencies?, options?) owns an imperative setup and its optional cleanup for one mounted component hook slot. Setup runs in Complete only after a successful render. Synchronous signal reads inside setup become reaction dependencies without making the component a render consumer.

The dependency array lists captured non-signal values and uses Object.is. Before replacement or final release, Pibbl clears and invokes the exact current cleanup once. Signal writes are forbidden during setup and cleanup.

Related type: PibblReactionOptions.

Owns one Complete-phase imperative reaction for a mounted hook slot.

useReaction: (setup: () => void | (() => void), dependencies?: readonly unknown[], options?: PibblReactionOptions) => void

Related API: useReaction, PibblReactionOptions.

  • setup — Setup callback; its optional returned cleanup runs when replaced or disposed.

  • dependencies — Values controlling when setup is repeated.

  • options — Optional diagnostic name for this reaction. See PibblReactionOptions.

PibblReactionOptions

View source — packages/core/src/lib/hooks/use-reaction.ts:74

Read the Authoring, signals, and lifecycle companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.

Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.