effect-io-ai

Package: @effect/atom-react
Module: Hooks

Hooks.useAtomMount

Mounts an atom in the current React registry for the lifetime of the component.

When to use

Use to keep an atom mounted from a React component without reading, writing, or refreshing it.

Details

The hook uses the current RegistryContext and releases the mount through React effect cleanup when the component unmounts or when the registry or atom dependency changes.

See

Signature

declare const useAtomMount: <A>(atom: Atom.Atom<A>) => void

Source

Since v4.0.0