3 ms·
Cool, but I tend to use sessionStorage as a backup to the store to re-hydrate on reload... I also use the thunks plugin so that I can have actioncreators that d
by tracker1 7y ago
Cool, but I tend to use sessionStorage as a backup to the store to re-hydrate on reload... I also use the thunks plugin so that I can have actioncreators that do multiple dispatches.
- acemarke 7y agoRight, and `configureStore` automatically adds the thunk middleware by default [0], as well as the Redux DevTools extension. You'd still have to pass in options for whatever persistence addon you want to use, but that would be something like: const store = configureStore({ reducer: rootReducer, middleware: [...getDefaultMiddleware(), myPersistenceMiddleware] }) Which is still shorter and easier to read than having to mess with `applyMiddleware` and `compose` yourself. [0] https://redux-toolkit.js.org/api/getDefaultMiddleware#included-default-middleware https://redux-toolkit.js.org/api/getDefaultMiddleware#includ...