Immutability Middleware#
A port of the redux-immutable-state-invariant middleware, customized for use with Redux Toolkit. Any detected mutations will be thrown as errors.
This middleware is added to the store by default by configureStore and getDefaultMiddleware.
You can customize the behavior of this middleware by passing any of the supported options as the immutableCheck value for getDefaultMiddleware.
Options#
Exports#
createImmutableStateInvariantMiddleware#
Creates an instance of the immutability check middleware, with the given options.
You will most likely not need to call this yourself, as getDefaultMiddleware already does so.
Example:
- TypeScript
- JavaScript
doing the same without removing all other middlewares, using getDetfaultMiddleware:
- TypeScript
- JavaScript
isImmutableDefault#
Default implementation of the "is this value immutable?" check. Currently implemented as:
This will return true for primitive types (like numbers, strings, booleans, null and undefined)