@epikodelabs/streamix / react/src/public-api / useIterable
Function: useIterable()
Call Signature
useIterable<
T>(source):T
Defined in: projects/libraries/streamix/react/src/lib/useIterable.ts:162
Reads a Streamix reactive source or any async iterable from React.
Streamix atoms, readables, derived values, and flows take the useSyncExternalStore path through their synchronous value + subscribe contract. Plain AsyncIterable<T> sources are consumed directly and expose their latest emitted value; those sources require an initialValue for the first render.
Pass a factory to make the hook own the returned source. Owned Streamix atoms are disposed on unmount. Plain async iterables are stopped when React unsubscribes from them.
Type Parameters
T
T
Parameters
source
Returns
T
Call Signature
useIterable<
T>(source,initialValue):T
Defined in: projects/libraries/streamix/react/src/lib/useIterable.ts:163
Reads a Streamix reactive source or any async iterable from React.
Streamix atoms, readables, derived values, and flows take the useSyncExternalStore path through their synchronous value + subscribe contract. Plain AsyncIterable<T> sources are consumed directly and expose their latest emitted value; those sources require an initialValue for the first render.
Pass a factory to make the hook own the returned source. Owned Streamix atoms are disposed on unmount. Plain async iterables are stopped when React unsubscribes from them.
Type Parameters
T
T
Parameters
source
initialValue
T
Returns
T
Call Signature
useIterable<
T>(factory,initialValue?):T
Defined in: projects/libraries/streamix/react/src/lib/useIterable.ts:164
Reads a Streamix reactive source or any async iterable from React.
Streamix atoms, readables, derived values, and flows take the useSyncExternalStore path through their synchronous value + subscribe contract. Plain AsyncIterable<T> sources are consumed directly and expose their latest emitted value; those sources require an initialValue for the first render.
Pass a factory to make the hook own the returned source. Owned Streamix atoms are disposed on unmount. Plain async iterables are stopped when React unsubscribes from them.
Type Parameters
T
T
Parameters
factory
() => Atom<T>
initialValue?
T
Returns
T
Call Signature
useIterable<
T>(factory,initialValue):T
Defined in: projects/libraries/streamix/react/src/lib/useIterable.ts:165
Reads a Streamix reactive source or any async iterable from React.
Streamix atoms, readables, derived values, and flows take the useSyncExternalStore path through their synchronous value + subscribe contract. Plain AsyncIterable<T> sources are consumed directly and expose their latest emitted value; those sources require an initialValue for the first render.
Pass a factory to make the hook own the returned source. Owned Streamix atoms are disposed on unmount. Plain async iterables are stopped when React unsubscribes from them.
Type Parameters
T
T
Parameters
factory
() => AsyncIterable<T>
initialValue
T
Returns
T