19 lines
305 B
JavaScript
19 lines
305 B
JavaScript
|
import { createStore, getValue } from 'nanostores'
|
||
|
|
||
|
const counter = createStore(() => {
|
||
|
counter.set(0)
|
||
|
})
|
||
|
|
||
|
function increaseCounter() {
|
||
|
counter.set(getValue(counter) + 1)
|
||
|
}
|
||
|
|
||
|
function decreaseCounter() {
|
||
|
counter.set(getValue(counter) - 1)
|
||
|
}
|
||
|
|
||
|
export {
|
||
|
counter,
|
||
|
increaseCounter,
|
||
|
decreaseCounter
|
||
|
}
|