Created
July 14, 2020 08:00
-
-
Save sonicoder86/90cbeb9cd89ac6f47e4a962df21353c0 to your computer and use it in GitHub Desktop.
You Might Not Need Vuex - part 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { reactive, readonly } from 'vue'; | |
export const createStore = () => { | |
const state = reactive({ counter: 0 }); | |
const increment = () => state.counter++; | |
return { increment, state: readonly(state) }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment