astro/examples/with-nanostores/src/store/counter.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
327 B
JavaScript
Raw Normal View History

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 });
}
2021-06-24 22:40:29 +00:00
export { counter, increaseCounter, decreaseCounter };