Convert Figma logo to code with AI

reduxjs logoredux-devtools

DevTools for Redux with hot reloading, action replay, and customizable UI

13,985
1,154
13,985
186

Top Related Projects

An extension that allows inspection of React component hierarchy in the Chrome and Firefox Developer Tools.

Redux DevTools extension.

The standalone app based on official debugger of React Native, and includes React Inspector / Redux DevTools

A desktop app for inspecting your React JS and React Native projects. macOS, Linux, and Windows.

Thunk middleware for Redux

Logger for Redux

Quick Overview

The Redux DevTools is a powerful set of tools that helps developers debug and monitor the state of their Redux applications. It provides a time-travel debugging experience, allowing developers to step through their application's state changes and understand how the state evolves over time.

Pros

  • Time-Travel Debugging: The Redux DevTools enables developers to step back and forth through their application's state changes, making it easier to identify and fix bugs.
  • State Monitoring: The DevTools provide a detailed view of the application's state, making it easier to understand how the state is changing over time.
  • Extensibility: The Redux DevTools can be extended with various plugins and integrations, allowing developers to customize the debugging experience to their needs.
  • Cross-Platform Support: The Redux DevTools is available for a variety of platforms, including web browsers, desktop applications, and mobile devices.

Cons

  • Overhead: Integrating the Redux DevTools into a project can add some overhead, as it requires additional setup and configuration.
  • Learning Curve: The Redux DevTools can have a steep learning curve, especially for developers who are new to Redux or state management in general.
  • Compatibility: The Redux DevTools may not be compatible with all versions of Redux or other related libraries, which can cause compatibility issues.
  • Performance Impact: Depending on the size and complexity of the application, the Redux DevTools can have a noticeable impact on performance, especially during development.

Code Examples

Here are a few examples of how to use the Redux DevTools:

  1. Enabling the Redux DevTools in a React application:
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './reducers';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const store = createStore(
  rootReducer,
  composeEnhancers(applyMiddleware(thunk))
);
  1. Dispatching actions and monitoring state changes:
import { useDispatch, useSelector } from 'react-redux';

const MyComponent = () => {
  const dispatch = useDispatch();
  const state = useSelector((state) => state);

  const handleClick = () => {
    dispatch({ type: 'INCREMENT' });
  };

  return (
    <div>
      <button onClick={handleClick}>Increment</button>
      <p>Current count: {state.count}</p>
    </div>
  );
};
  1. Replaying actions with the Redux DevTools:
import { useDispatch } from 'react-redux';

const MyComponent = () => {
  const dispatch = useDispatch();

  const handleReplay = () => {
    dispatch({ type: 'REPLAY_ACTIONS' });
  };

  return (
    <div>
      <button onClick={handleReplay}>Replay Actions</button>
    </div>
  );
};

Getting Started

To get started with the Redux DevTools, follow these steps:

  1. Install the Redux DevTools extension in your web browser:

  2. In your Redux application, enable the Redux DevTools by using the composeEnhancers function:

import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './reducers';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const store = createStore(
  rootReducer,
  composeEnhancers(applyMiddleware(thunk))
);
  1. Start your application and open the Redux DevTools panel in your browser. You should now be able to see and interact with your application's state.

  2. Explore the various features of the Redux DevTools, such as time-travel debugging

Competitor Comparisons

An extension that allows inspection of React component hierarchy in the Chrome and Firefox Developer Tools.

Pros of React DevTools

  • Provides a visual representation of the React component tree, making it easier to understand the structure of the application.
  • Allows you to inspect the state and props of individual components, which can be helpful for debugging.
  • Supports time-travel debugging, allowing you to step through the application's history and see how the state changes over time.

Cons of React DevTools

  • Primarily focused on React, so it may not be as useful for applications that don't use React.
  • The user interface can be complex and overwhelming, especially for developers who are new to React.
  • Requires the React DevTools browser extension to be installed, which can be an additional step for some users.

Code Comparison

Redux DevTools:

import { createStore } from 'redux';

const reducer = (state = 0, action) => {
  switch (action.type) {
    case 'INCREMENT':
      return state + 1;
    case 'DECREMENT':
      return state - 1;
    default:
      return state;
  }
};

const store = createStore(reducer);

store.dispatch({ type: 'INCREMENT' });
console.log(store.getState()); // Output: 1

React DevTools:

import React, { useState } from 'react';

function Counter() {
  const [count, setCount] = useState(0);

  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>Increment</button>
      <button onClick={() => setCount(count - 1)}>Decrement</button>
    </div>
  );
}

export default Counter;

Redux DevTools extension.

Pros of Redux DevTools Extension

  • Cross-browser support: The Redux DevTools Extension is available as a browser extension for Chrome, Firefox, and Edge, making it accessible to a wider range of developers.
  • Improved performance: The extension is designed to be more performant than the standalone Redux DevTools library, with faster rendering and reduced overhead.
  • Broader feature set: The extension includes additional features beyond the core Redux DevTools functionality, such as support for other state management libraries like MobX and Vuex.

Cons of Redux DevTools Extension

  • Dependency on browser extension: The Redux DevTools Extension requires the user to install a browser extension, which can be an additional step for some developers.
  • Limited customization: The extension has a more limited set of customization options compared to the standalone Redux DevTools library.
  • Potential compatibility issues: The extension may not always be compatible with the latest versions of Redux or other state management libraries.

Code Comparison

Here's a brief code comparison between the two projects:

Redux DevTools (reduxjs/redux-devtools):

import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './reducers';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const store = createStore(
  rootReducer,
  composeEnhancers(applyMiddleware(thunk))
);

Redux DevTools Extension (zalmoxisus/redux-devtools-extension):

import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './reducers';
import { composeWithDevTools } from 'redux-devtools-extension';

const store = createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(thunk))
);

The main difference is the way the Redux DevTools Extension is integrated into the store creation process. The composeWithDevTools function from the extension is used instead of the composeEnhancers approach in the standalone Redux DevTools library.

The standalone app based on official debugger of React Native, and includes React Inspector / Redux DevTools

Pros of React Native Debugger

  • Integrated Debugger: React Native Debugger combines the functionality of the React Native debugger and the Redux DevTools, providing a comprehensive debugging experience in a single tool.
  • Cross-Platform Support: The tool is compatible with both iOS and Android platforms, making it a versatile choice for React Native developers.
  • Enhanced Debugging Features: React Native Debugger offers additional features like network inspection, element inspection, and performance monitoring, which can be helpful in identifying and resolving issues.

Cons of React Native Debugger

  • Limited to React Native: While React Native Debugger is a powerful tool for React Native development, it is not applicable to other JavaScript frameworks or libraries.
  • Potential Compatibility Issues: The tool may occasionally encounter compatibility issues with certain versions of React Native or other dependencies, requiring manual configuration or troubleshooting.
  • Dependency on Electron: React Native Debugger is built on Electron, which can result in a larger application footprint and potential performance concerns on some systems.

Code Comparison

Here's a brief code comparison between the Redux DevTools and React Native Debugger:

Redux DevTools:

import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './reducers';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const store = createStore(
  rootReducer,
  composeEnhancers(applyMiddleware(thunk))
);

React Native Debugger:

import React from 'react';
import { AppRegistry } from 'react-native';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './reducers';

const store = createStore(
  rootReducer,
  applyMiddleware(thunk)
);

const App = () => (
  <Provider store={store}>
    {/* Your app components */}
  </Provider>
);

AppRegistry.registerComponent('MyApp', () => App);

A desktop app for inspecting your React JS and React Native projects. macOS, Linux, and Windows.

Pros of Reactotron

  • Reactotron provides a more comprehensive debugging experience, including the ability to inspect network requests, state, and performance.
  • Reactotron has a more intuitive and visually appealing user interface compared to Redux DevTools.
  • Reactotron supports a wider range of platforms, including React Native, which can be useful for developers working on mobile applications.

Cons of Reactotron

  • Reactotron may have a steeper learning curve compared to Redux DevTools, which is more widely adopted and has a larger community.
  • Reactotron may have fewer integrations and plugins compared to Redux DevTools, which has a large ecosystem of third-party tools.

Code Comparison

Redux DevTools:

import { createStore } from 'redux';

const reducer = (state = 0, action) => {
  switch (action.type) {
    case 'INCREMENT':
      return state + 1;
    case 'DECREMENT':
      return state - 1;
    default:
      return state;
  }
};

const store = createStore(reducer);

Reactotron:

import Reactotron from 'reactotron-react-js';

Reactotron
  .configure()
  .connect();

const reducer = (state = 0, action) => {
  switch (action.type) {
    case 'INCREMENT':
      return state + 1;
    case 'DECREMENT':
      return state - 1;
    default:
      return state;
  }
};

const store = createStore(reducer, Reactotron.createEnhancer());

Thunk middleware for Redux

Pros of Redux Thunk

  • Simplicity: Redux Thunk is a lightweight and straightforward middleware that allows you to write asynchronous actions.
  • Flexibility: With Redux Thunk, you can perform complex asynchronous operations, such as making API calls, without cluttering your action creators.
  • Testability: Redux Thunk makes it easier to test your asynchronous actions, as you can mock the API calls and test the action creators in isolation.

Cons of Redux Thunk

  • Limited Functionality: Redux Thunk is a basic middleware and may not provide advanced features for managing complex asynchronous flows.
  • Boilerplate: Using Redux Thunk may require you to write more boilerplate code to handle asynchronous actions.
  • Potential for Complexity: As your application grows, managing the asynchronous logic in your action creators can become more complex and harder to maintain.

Code Comparison

Redux Thunk:

export const fetchData = () => {
  return (dispatch) => {
    dispatch(fetchDataRequest());
    fetch('/api/data')
      .then((response) => response.json())
      .then((data) => dispatch(fetchDataSuccess(data)))
      .catch((error) => dispatch(fetchDataFailure(error)));
  };
};

Redux DevTools:

import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunk from 'redux-thunk';
import rootReducer from './reducers';

const store = createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(thunk))
);

Logger for Redux

Pros of LogRocket/redux-logger

  • Detailed Logging: Redux-logger provides detailed logging of actions, state changes, and performance metrics, making it easier to debug and understand the state of your application.
  • Customizable Logging: The logger can be customized to log specific actions, state changes, or even to filter out certain actions.
  • Compatibility: Redux-logger is compatible with a wide range of Redux-based applications, including those using middleware like Redux Thunk or Redux Saga.

Cons of LogRocket/redux-logger

  • Performance Impact: Redux-logger can have a noticeable performance impact on your application, especially in production environments where logging may not be necessary.
  • Limited Functionality: While Redux-logger provides detailed logging, it lacks the advanced debugging and visualization features of Redux DevTools.

Code Comparison

Redux DevTools:

import { createStore, applyMiddleware, compose } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import reducer from './reducer';

const store = createStore(
  reducer,
  composeWithDevTools(
    applyMiddleware(/* your middleware */)
  )
);

Redux Logger:

import { createStore, applyMiddleware } from 'redux';
import logger from 'redux-logger';
import reducer from './reducer';

const store = createStore(
  reducer,
  applyMiddleware(logger)
);

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

GitHub Workflow Status PRs Welcome OpenCollective OpenCollective

Redux DevTools

Developer Tools to power-up Redux development workflow or any other architecture which handles the state change (see integrations).

It can be used as a browser extension (for Chrome, Edge and Firefox), as a standalone app or as a React component integrated in the client app.

image

Documentation

Development

This is a monorepo powered by pnpm and Nx. Install pnpm and run pnpm install to get started. Each package's dependencies need to be built before the package itself can be built. You can either build all the packages (i.e., pnpm run build:all) or use Nx commands to build only the packages necessary for the packages you're working on (i.e., pnpm nx build remotedev-redux-devtools-extension).

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

License

MIT

NPM DownloadsLast 30 Days