I am trying to learn Redux Toolkit and came across the default middleware for configureStore():
According to this page:
Immutability check middleware: deeply compares state values for mutations. It can detect mutations in reducers during a dispatch, and also mutations that occur between dispatches (such as in a component or a selector). When a mutation is detected, it will throw an error and indicate the key path for where the mutated value was detected in the state tree. (Forked from redux-immutable-state-invariant.)
I am confused. Aren't the reducers and dispatch function supposed to mutate state values? Why should errors ever be thrown?