Blog>
Snippets

Time-Travel Debugging with Redux DevTools

Showcase how to configure the Redux store to enable time-travel debugging with Redux DevTools in an application using Redux Toolkit.
import { configureStore } from '@reduxjs/toolkit';
import rootReducer from './reducers'; // replace './reducers' with the actual path

// Configure Redux store with Redux Toolkit
const store = configureStore({
  reducer: rootReducer,
  // Enable Redux DevTools Extension
  devTools: process.env.NODE_ENV !== 'production'
});

export default store;
This code snippet showcases how to configure a Redux store using Redux Toolkit that allows enabling Redux DevTools Extension for time-travel debugging. Redux DevTools are enabled only if the application is running in a non-production environment.
// Assuming you have already set up the Redux DevTools browser extension

// To travel back and forth between states:
// Click on the action you want to go back to in the Redux DevTools.
// Use the 'Jump' button to move the state to that point in time.
These comments explain how to use the Redux DevTools browser extension in conjunction with the Redux store, setup for time-travel debugging. It describes how to go back to a specific action within the DevTools panel.