JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/vuex"></script>
<div id="app">
<p>
Our current count is: <strong>{{ count }}</strong>
</p>
</div>
CSS
#app {
padding: 15px 0;
}
JavaScript
const store = new Vuex.Store({
state: {
count: 0
},
mutations: {
increase(state) {
state.count++
},
decrease(state) {
state.count--
}
}
})
new Vue({
el: '#app',
computed: {
count() {
return store.state.count
}
}
})