astro/examples/with-nanostores/src/store/counter.js
2021-12-22 16:11:05 -05:00

15 lines
327 B
JavaScript

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 };