Function
useAtomSubscribe
(
atom: () => Atom.Atom<A>,
f: (_: A) => void,
options?: { readonly immediate?: boolean }
)
Source from the content-addressed store, hash-verified
| 235 | * @since 4.0.0 |
| 236 | */ |
| 237 | export const useAtomSubscribe = <A>( |
| 238 | atom: () => Atom.Atom<A>, |
| 239 | f: (_: A) => void, |
| 240 | options?: { readonly immediate?: boolean } |
| 241 | ): void => { |
| 242 | const registry = useContext(RegistryContext) |
| 243 | createEffect(() => { |
| 244 | onCleanup(registry.subscribe(atom(), f, options)) |
| 245 | }) |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * Converts an `AsyncResult` atom into a Solid resource. |
Callers
nothing calls this directly
Tested by
no test coverage detected