Skip to content

Instantly share code, notes, and snippets.

@Rajatgms
Last active January 9, 2023 19:28
Show Gist options
  • Save Rajatgms/39b2dcccd4d0349fa64311d44029ab2e to your computer and use it in GitHub Desktop.
Save Rajatgms/39b2dcccd4d0349fa64311d44029ab2e to your computer and use it in GitHub Desktop.
createStore vs configureStore
// Redux STORE
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const prodMiddleware = [thunk, immutableStateInvariant, serializableStateInvariant]:
const devMiddleware = [thunk];
const middleware = process.env.prod ? prodMiddleware : devMiddleware;
const enhancer = composeEnhancers(applyMiddleware(...middleware));
const ReduxStore = createStore(rootReducer, enhancer);
// RTK STORE
const RTKStore = configureStore({reducer: rootReducer});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment