# Migrating to 4.0 from 3.x Almost all Vuex 4 APIs have remained unchanged from Vuex 3. However, there are still a few breaking changes that you must fix. - [Breaking Changes](#breaking-changes) - [Installation process](#installation-process) - [TypeScript support](#typescript-support) - [Bundles are now aligned with Vue 3](#bundles-are-now-aligned-with-vue-3) - ["createLogger" function is exported from the core module](#createlogger-function-is-exported-from-the-core-module) - [New Features](#new-features) - [New "useStore" composition function](#new-usestore-composition-function) ## Breaking Changes ### Installation process To align with the new Vue 3 initialization process, the installation process of Vuex has changed. To create a new store, users are now encouraged to use the newly introduced createStore function. ```js import { createStore } from 'vuex' export const store = createStore({ state () { return { count: 1 } } }) ``` To install Vuex to a Vue instance, pass the `store` instead of Vuex. ```js import { createApp } from 'vue' import { store } from './store' import App from './App.vue' const app = createApp(App) app.use(store) app.mount('#app') ``` :::tip NOTE Whilst this is not technically a breaking change, you may still use the `new Store(...)` syntax, we recommend this approach to align with Vue 3 and Vue Router Next. ::: ### TypeScript support Vuex 4 removes its global typings for `this.$store` within a Vue component to solve [issue #994](https://github.com/vuejs/vuex/issues/994). When used with TypeScript, you must declare your own module augmentation. Place the following code in your project to allow `this.$store` to be typed correctly: ```ts // vuex-shim.d.ts import { ComponentCustomProperties } from 'vue' import { Store } from 'vuex' declare module 'vue' { // Declare your own store states. interface State { count: number } interface ComponentCustomProperties { $store: Store } } ``` You can learn more in the [TypeScript Support](./typescript-support) section. ### Bundles are now aligned with Vue 3 The following bundles are generated to align with Vue 3 bundles: - `vuex.global(.prod).js` - For direct use with `