Blog>
Snippets

Adapting to the new Redux DevTools Extension Integration

Update the code to integrate with the Redux DevTools Extension using the new Redux v5.0.0 API.
import { configureStore } from '@reduxjs/toolkit';
import rootReducer from './reducers';

const store = configureStore({
  reducer: rootReducer,
  devTools: process.env.NODE_ENV !== 'production'
});

export default store;
This snippet creates a Redux store using the new `configureStore` method from Redux Toolkit. It automatically sets up the Redux DevTools Extension integration based on the environment, enabling it in development.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Redux DevTools Extension Integration</title>
</head>
<body>
    <div id="root"></div>
    <!-- Ensure your bundler injects your script here -->
    <script src="path/to/your/bundled/script.js"></script>
</body>
</html>
Basic HTML structure to load a Redux-enabled app. The bundled JavaScript file, which should define and create the Redux store, needs to be included in the script tag.
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}
CSS to reset default body margin and set a system font stack. The `#root` element is styled to center its children both vertically and horizontally, occupying the full height of the viewport.