UNINITIALIZED

See source code

Type

The type of the first value passed to a computed signal function as the 'prevValue' parameter. This type represents the uninitialized state of a computed signal before its first calculation.

type UNINITIALIZED = typeof UNINITIALIZED;

Value

A special symbol used to indicate that a computed signal has not been initialized yet. This is passed as the previousValue parameter to a computed signal function on its first run.

UNINITIALIZED: unique symbol;

Example

const count = atom("count", 0);
const double = computed("double", (prevValue) => {
  if (isUninitialized(prevValue)) {
    console.log("First computation!");
  }
  return count.get() * 2;
});
Prev
RESET_VALUE
Next
WithDiff