Skip to content

Interface: AtomOptions<T>

API / @xmachines/play-atom / AtomOptions

Defined in: play-atom/src/types.ts:147

The options of createAtom

compare decides if the value changed. The default is Object.is. An atom that compares equal notifies no observer.

Example

import { createAtom } from "@xmachines/play-atom";
const point = createAtom(
{ x: 0, y: 0 },
{ compare: (previous, next) => previous.x === next.x && previous.y === next.y },
);

Type Parameters

Type Parameter
T

Properties

PropertyTypeDefined in
compare?(previous, next) => booleanplay-atom/src/types.ts:148