Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / src/public-api / atom

Function: atom() ​

Call Signature ​

atom<T>(): Atom<T>

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:1260

Creates a writable atom without an initial value.

The value type should usually be provided explicitly:

ts
const user = atom<User>();

Type Parameters ​

T ​

T = any

Returns ​

Atom<T>

Call Signature ​

atom<T>(noInitialValue, options?): Atom<T>

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:1264

Creates a writable atom that intentionally starts without an initial value.

Type Parameters ​

T ​

T = any

Parameters ​

noInitialValue ​

typeof NO_INITIAL_VALUE

options? ​

AtomOptions

Returns ​

Atom<T>

Call Signature ​

atom<T>(initialValue, options?): Atom<T>

Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:1273

Creates a writable atom with an initial value.

ts
const count = atom(0);
count.set(count.value + 1);

Type Parameters ​

T ​

T = any

Parameters ​

initialValue ​

T

options? ​

AtomOptions

Returns ​

Atom<T>

Released under the MIT License.