Skip to content

useConst

Read as Markdown

useConst(create) runs create once for a mounted component hook slot and returns that same direct value on later renders. The factory runs untracked, so signal reads inside it are snapshots rather than component dependencies.

Use it for mount-lifetime values such as typed arrays or immutable helpers. It does not create a signal, schedule work, or provide automatic cleanup.

Creates one non-reactive value for the lifetime of a mounted hook slot.

useConst: <T>(create: () => T) => T

Related API: useConst.

  • create — Initializer called once for this mounted hook slot.

The value retained by this hook slot.

PibblComponent

View source — packages/core/src/lib/hooks/use-const.ts:13

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.