Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tim-smart/effect-atom/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheuseAtomMount hook mounts an atom in the registry, ensuring it stays alive during the component’s lifecycle without subscribing to its updates. This is useful when you want to keep an atom active but don’t need to read its value.
Signature
The atom to mount in the registry
Behavior
- Mounts the atom when the component renders
- Keeps the atom mounted while the component is mounted
- Unmounts the atom when the component unmounts
- Does not trigger re-renders when the atom value changes
Usage
Keep an atom alive
UseuseAtomMount to keep an atom active without reading its value:
Preload data
Mount atoms to preload data without displaying it:Side-effect atoms
Keep atoms with side effects running:Comparison with other hooks
| Hook | Subscribes to updates | Returns value | Keeps mounted |
|---|---|---|---|
useAtomValue | Yes | Yes | Yes |
useAtomMount | No | No | Yes |
useAtomSet | No | No | Yes |
Related hooks
- useAtomValue - Read atom values with subscription
- useAtomSet - Write to atoms
- useAtomRefresh - Manually refresh an atom