Skip to content

@epikodelabs/streamix


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

Function: atom() ​

Call Signature ​

atom<T>(): Writable<T>

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

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 ​

Writable<T>

Call Signature ​

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

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

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 ​

Writable<T>

Call Signature ​

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

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

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 ​

Writable<T>

Released under the MIT License.