Does Redux toolkit automatically come with the package React-immutable-state-invariant? I am getting terrible performance updating my state with some large objects since it seems that React-immutable-state-invariant has a detect mutations function that looks through all the the keys of this object multiple times.
I do not want to use this package. Looking at the github it seems to say that you should not use this in production. I don't want to even use it in development since Redux toolkit has immer for direct state mutations anyway.
How can I configure Redux Toolkit to not use this middleware? Thank you
I see https://github.com/reduxjs/redux-toolkit/issues/412
Is there not a current way to configure middleware right now?
Just answered this on Reddit, but I'll answer here as well:
Yes, we use immutable-state-invariant by default, in development mode only. And yes, it is a deep check of your entire state, so if you have a rather large state, that will slow things down. Ditto for the serializable check middleware.
Per the docs, you can disable either of the dev check middleware by using getDefaultMiddleware() options.
See the docs for configureStore - you can use different middlewares.
const store = configureStore({
reducer: {/*...*/},
middleware: [...getDefaultMiddleware({immutableCheck: false})]
})
Most helpful comment
See the docs for configureStore - you can use different middlewares.