Skip to main content

Bool

import { boolBox, type BoolBox } from 'amos';

BoolBox stores a boolean.

const modalOpenBox = boolBox('ui.modalOpen');

dispatch(modalOpenBox.open());
dispatch(modalOpenBox.toggle());
dispatch(modalOpenBox.close());

boolBox

function boolBox(key: string, initialState?: boolean): BoolBox;

If initialState is omitted, the initial value is false.

Mutations

toggle(): Mutation<boolean>;
open(): Mutation<boolean>;
close(): Mutation<boolean>;

toggle() flips the current value.

open() sets the value to true.

close() sets the value to false.