@effectify/solid-effect-atom
useAtom
Section titled “useAtom”Subscribes to an atom and returns a tuple of [accessor, setter].
function useAtom<R, W>(
atom: Atom.Writable<R, W>,
): [Accessor<R>, (value: W) => void]useAtomValue
Section titled “useAtomValue”Subscribes to an atom and returns its value as an accessor.
function useAtomValue<A>(atom: Atom.Atom<A>): Accessor<A>
function useAtomValue<A, B>(atom: Atom.Atom<A>, f: (a: A) => B): Accessor<B>useAtomSet
Section titled “useAtomSet”Returns a setter function for the atom without subscribing to its value.
function useAtomSet<R, W>(atom: Atom.Writable<R, W>): (value: W) => voiduseAtomSubscribe
Section titled “useAtomSubscribe”Subscribes to changes in an atom’s value.
function useAtomSubscribe<A>(
atom: Atom.Atom<A>,
f: (value: A) => void,
options?: { immediate?: boolean },
): voiduseAtomMount
Section titled “useAtomMount”Mounts an atom in the registry without subscribing to its value. This is useful for keeping an atom alive.
function useAtomMount<A>(atom: Atom.Atom<A>): voiduseAtomRefresh
Section titled “useAtomRefresh”Returns a function that forces an atom to refresh its value.
function useAtomRefresh<A>(atom: Atom.Atom<A>): () => voiduseAtomInitialValues
Section titled “useAtomInitialValues”Sets initial values for atoms in the current registry. Useful for SSR or initialization.
function useAtomInitialValues(
initialValues: Iterable<[Atom.Atom<any>, any]>,
): voiduseAtomRef
Section titled “useAtomRef”Subscribes to an AtomRef and returns its value as an accessor.
function useAtomRef<A>(ref: AtomRef.ReadonlyRef<A>): Accessor<A>useAtomRefProp
Section titled “useAtomRefProp”Creates a derived AtomRef for a specific property of an object stored in an AtomRef.
function useAtomRefProp<A, K extends keyof A>(
ref: AtomRef.AtomRef<A>,
prop: K,
): AtomRef.AtomRef<A[K]>useAtomRefPropValue
Section titled “useAtomRefPropValue”Subscribes to a specific property of an object stored in an AtomRef.
function useAtomRefPropValue<A, K extends keyof A>(
ref: AtomRef.AtomRef<A>,
prop: K,
): Accessor<A[K]>Context
Section titled “Context”RegistryProvider
Section titled “RegistryProvider”Provides the AtomRegistry context to the component tree. This is required for all atom hooks to work.
function RegistryProvider(props: {
children?: JSX.Element
initialValues?: Iterable<[Atom.Atom<any>, any]>
scheduleTask?: (f: () => void) => () => void
timeoutResolution?: number
defaultIdleTTL?: number
}): JSX.Element