2021-06-24 22:40:29 +00:00
|
|
|
import { createStore, getValue } from 'nanostores';
|
2021-06-24 22:39:17 +00:00
|
|
|
|
|
|
|
const counter = createStore(() => {
|
2021-06-24 22:40:29 +00:00
|
|
|
counter.set(0);
|
|
|
|
});
|
2021-06-24 22:39:17 +00:00
|
|
|
|
|
|
|
function increaseCounter() {
|
2021-06-24 22:40:29 +00:00
|
|
|
counter.set(getValue(counter) + 1);
|
2021-06-24 22:39:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function decreaseCounter() {
|
2021-06-24 22:40:29 +00:00
|
|
|
counter.set(getValue(counter) - 1);
|
2021-06-24 22:39:17 +00:00
|
|
|
}
|
|
|
|
|
2021-06-24 22:40:29 +00:00
|
|
|
export { counter, increaseCounter, decreaseCounter };
|