useReaction
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.
API details from source
Section titled “API details from source”
Owns one Complete-phase imperative reaction for a mounted hook slot.
useReaction: (setup: () => void | (() => void), dependencies?: readonly unknown[], options?: PibblReactionOptions) => voidRelated API: useReaction, PibblReactionOptions.
Parameters
Section titled “Parameters”-
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.
See also
Section titled “See also”View source — packages/core/src/lib/hooks/use-reaction.ts:74
Implementation guidance for agents
Section titled “Implementation guidance for agents”Read the Authoring, signals, and lifecycle companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.
Complete minimal examples
Section titled “Complete minimal examples”- Component-owned state and reactions: Click to update a signal, derive a value, and publish an imperative effect after commit. Plain source
Interactive examples
Section titled “Interactive examples”Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.