Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Vuex Quick Start Guide

You're reading from   Vuex Quick Start Guide Centralized State Management for your Vue.js applications

Arrow left icon
Product type Paperback
Published in Apr 2018
Publisher Packt
ISBN-13 9781788999939
Length 152 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Andrea Koutifaris Andrea Koutifaris
Author Profile Icon Andrea Koutifaris
Andrea Koutifaris
Arrow right icon
View More author details
Toc

Enabling strict mode while developing

When Vuex is in strict mode, it will throw an error if the single state tree is mutated outside mutation handlers. This is useful when developing to prevent accidental modifications to the state. To enable strict mode, you just need to add strict: true to the store configuration object:

const store = new Vuex.Store({
// ...
strict: true
});

Strict mode should not be used in production. Strict mode runs a synchronous deep watcher on the state tree for detecting inappropriate mutations, and this can slow down the application. To avoid changing strict to false each time you want to create a production bundle, you should use a build tool that makes the strict value false when creating the production bundle. For example, you could use the following snippet in conjunction with webpack:

const store = new Vuex.Store({
// ...
strict: process.env...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image