foxstate-vanilla
v0.1.3
Published
Vue bindings for FoxState.
Downloads
97
Readme
foxstate-vue
Vue bindings for FoxState.
Install
npm install fox-state foxstate-vueUsage
import { createStore } from "fox-state"
import { useStore } from "foxstate-vue"
const counter = createStore({
state: { count: 0 }
})
export default {
setup() {
const state = useStore(counter)
const inc = () => {
counter.setState({ count: state.value.count + 1 })
}
return { state, inc }
}
}<template>
<button @click="inc">
{{ state.count }}
</button>
</template>