Suggest an editImprove this articleRefine the answer for “Why does Pinia have no mutations?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**Pinia** has no mutations because they became unnecessary with the arrival of the Composition API and Vue 3's new reactivity: state can now be changed directly (`this.count++`), and Vue tracks it automatically. **Key point:** removing mutations reduces boilerplate, improves TypeScript typing, and makes the architecture simpler (state → actions → component instead of state → mutation → action → component).Shown above the full answer for quick recall.Answer (EN)Image## Main reasons why Pinia has no mutations --- ## 1. Vue 3 uses Composition API reactivity, so mutations became unnecessary In Vuex, mutations were needed to: - track who changed the state - ensure predictable updates - register changes for DevTools But **in Vue 3, all reactivity is visible out of the box**, and state changes are tracked automatically. So the need for a separate layer, **mutations**, disappeared. The extra layer was removed Pinia simplifies the architecture: state → actions → component --- ## 2. Mutations created excessive boilerplate in Vuex Comparison: #### Vuex: ```js mutations: { increment(state) { state.count++ } }, actions: { increment({ commit }) { commit('increment') } } ``` #### Pinia: ```js actions: { increment() { this.count++ } } ``` Boilerplate in Vuex: - writing a mutation - writing an action - calling commit - maintaining huge files full of mutations Pinia removed an entire layer, less code, an easier life. --- ## 3. Mutations work poorly with TypeScript Vuex + TS = a lot of pain: - it is hard to type the payload - types have to be declared by hand - mutations easily cause type mismatches Pinia was designed from the start **for TypeScript**, so: - mutations are not needed - actions get automatic typing - state and getters are inferred automatically Removing mutations means cleaner, stricter typing. --- ## 4. Mutations make no sense when you can change the state directly Pinia lets you do: ```js this.count++ ``` So why write: ```js commit('increment') ``` Or: ```js mutations: { increment(state) { state.count++ } } ``` **Direct changes are safe**, because Vue 3's reactivity tracks everything automatically. Mutations are just an unnecessary middleman. --- ## 5. In Vuex, mutations created too many layers In Vuex, data flows through: ``` state → mutation → action → component ``` In Pinia: ``` state → action → component ``` Fewer layers → easier to understand the code → easier to debug. --- ## 6. Vue 3's DevTools can track changes without mutations Vuex required mutations so DevTools could show: - which fields changed - when and by what Pinia does not need mutations: - changes to Vue 3's reactive state are logged automatically - DevTools gets the information directly - there is no need to manually separate mutations and actions Mutations lost their purpose. --- ## Summary (perfect for an interview) > **Pinia has no mutations because they became unnecessary with the arrival of the Composition API and Vue 3's new reactivity.** > **Direct state changes are safe, simpler, and fully tracked by DevTools.** > **Removing mutations reduces boilerplate, improves typing, and makes the architecture cleaner and simpler.**For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.