2021-11-22 00:31:42 +07:00
|
|
|
import { atom } from 'nanostores';
|
2021-06-24 19:39:17 -03:00
|
|
|
|
2021-12-13 15:37:06 -03:00
|
|
|
const initialValue = { value: 0 };
|
|
|
|
|
|
|
|
const counter = atom(initialValue);
|
2021-06-24 19:39:17 -03:00
|
|
|
|
|
|
|
function increaseCounter() {
|
2021-12-13 15:37:06 -03:00
|
|
|
counter.set({ value: counter.get().value + 1 });
|
2021-06-24 19:39:17 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
function decreaseCounter() {
|
2021-12-13 15:37:06 -03:00
|
|
|
counter.set({ value: counter.get().value - 1 });
|
2021-06-24 19:39:17 -03:00
|
|
|
}
|
|
|
|
|
2021-06-24 22:40:29 +00:00
|
|
|
export { counter, increaseCounter, decreaseCounter };
|