summaryrefslogtreecommitdiff
path: root/examples/with-nanostores/src/store/counter.js
blob: d4c29ad62bfdf80ee25389076fbf6b5a6ef64bdd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { atom } from 'nanostores';

const initialValue = { value: 0 };

const counter = atom(initialValue);

function increaseCounter() {
	counter.set({ value: counter.get().value + 1 });
}

function decreaseCounter() {
	counter.set({ value: counter.get().value - 1 });
}

export { counter, increaseCounter, decreaseCounter };