effect-io-ai

Package: @effect/atom-react
Module: Hooks

Hooks.useAtomRef

Subscribes to an atom ref and returns its latest value.

When to use

Use when a React component should render from an AtomRef.ReadonlyRef directly instead of reading an atom through the current registry.

Details

The hook subscribes with ref.subscribe, triggers re-renders through React state, and returns the current ref.value.

See

Signature

declare const useAtomRef: <A>(ref: AtomRef.ReadonlyRef<A>) => A

Source

Since v4.0.0