Skip to content

Instantly share code, notes, and snippets.

@sonicoder86
Created July 14, 2020 08:00
Show Gist options
  • Save sonicoder86/90cbeb9cd89ac6f47e4a962df21353c0 to your computer and use it in GitHub Desktop.
Save sonicoder86/90cbeb9cd89ac6f47e4a962df21353c0 to your computer and use it in GitHub Desktop.
You Might Not Need Vuex - part 6
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