Skip to main content

isUninitialized()

Call this inside a computed signal function to determine whether it is the first time the function is being called.

Mainly useful for incremental signal computation.

Example

const count = atom('count', 0)
const double = computed('double', (prevValue) => {
if (isUninitialized(prevValue)) {
console.log('First time!')
}
return count.value * 2
})

@param value - The value to check.
@public

## Signature

```ts
isUninitialized(value: any): value is typeof UNINITIALIZED;

Parameters

NameType
valueany

Returns

value is typeof UNINITIALIZED

Defined in: signia/src/Computed.ts:39