Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

redux-devtools-extension

> 开发工具
Open source

Redux DevTools extension.

13.5K stars0 likes0 views
WebsiteGitHub

About

Redux DevTools extension.

⚠️⚠️⚠️🚨🚨🚨⚠️⚠️⚠️

This repo is no longer the home of the redux-devtools-extension. The new home is https://github.com/reduxjs/redux-devtools. Please file your issues and PRs there.

⚠️⚠️⚠️🚨🚨🚨⚠️⚠️⚠️

Redux DevTools Extension

Installation

1. For Chrome

  • from Chrome Web Store;
  • or download extension.zip from last releases, unzip, open chrome://extensions url and turn on developer mode from top left and then click; on Load Unpacked and select the extracted folder for use
  • or build it with npm i && npm run build:extension and load the extension's folder ./build/extension;
  • or run it in dev mode with npm i && npm start and load the extension's folder ./dev.

2. For Firefox

  • from Mozilla Add-ons;
  • or build it with npm i && npm run build:firefox and load the extension's folder ./build/firefox (just select a file from inside the dir).

3. For Electron

  • just specify REDUX_DEVTOOLS in electron-devtools-installer.

4. For other browsers and non-browser environment

  • use remote-redux-devtools.

Usage

Note that starting from v2.7, window.devToolsExtension was renamed to window.__REDUX_DEVTOOLS_EXTENSION__ / window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__.

1. With Redux

1.1 Basic store

For a basic Redux store simply add:

diff
 const store = createStore(
   reducer, /* preloadedState, */
+  window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
 );

Note that preloadedState argument is optional in Redux's createStore.

For universal ("isomorphic") apps, prefix it with typeof window !== 'undefined' &&.

javascript
const composeEnhancers = (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;

For TypeScript use redux-devtools-extension npm package, which contains all the definitions, or just use (window as any) (see Recipes for an example).

javascript
const composeEnhancers = (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

In case ESLint is configured to not allow using the underscore dangle, wrap it like so:

diff
+ /* eslint-disable no-underscore-dangle */
  const store = createStore(
   reducer, /* preloadedState, */
   window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
  );
+ /* eslint-enable */

Note: Passing enhancer as last argument requires redux@>=3.1.0. For older versions apply it like here or here. Don't mix the old Redux API with the new one.

You don't need to npm install redux-devtools when using the extension (that's a different lib).

1.2 Advanced store setup

If you setup your store with middleware and enhancers, change:

diff
  import { createStore, applyMiddleware, compose } from 'redux';

+ const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
+ const store = createStore(reducer, /* preloadedState, */ composeEnhancers(
- const store = createStore(reducer, /* preloadedState, */ compose(
    applyMiddleware(...middleware)
  ));

Note that when the extension is not installed, we’re using Redux compose here.

To specify extension’s options, use it like so:

javascript
const composeEnhancers =
  typeof window === 'object' &&
  window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?   
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
      // Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
    }) : compose;

const enhancer = composeEnhancers(
  applyMiddleware(...middleware),
  // other store enhancers if any
);
const store = createStore(reducer, enhancer);

See the post for more details.

1.3 Use redux-devtools-extension package from npm

To make things easier, there's an npm package to install:

bash
npm install --save redux-devtools-extension

and to use like so:

javascript
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';

const store = createStore(reducer, composeWithDevTools(
  applyMiddleware(...middleware),
  // other store enhancers if any
));

To specify extension’s options:

javascript
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';

const composeEnhancers = composeWithDevTools({
  // Specify name here, actionsBlacklist, actionsCreators and other options if needed
});
const store = createStore(reducer, /* preloadedState, */ composeEnhancers(
  applyMiddleware(...middleware),
  // other store enhancers if any
));

There’re just few lines of code added to your bundle.

In case you don't include other enhancers and middlewares, just use devToolsEnhancer:

javascript
import { createStore } from 'redux';
import { devToolsEnhancer } from 'redux-devtools-extension';

const store = createStore(reducer, /* preloadedState, */ devToolsEnhancer(
  // Specify name here, actionsBlacklist, actionsCreators and other options if needed
));

1.4 Using in production

It's useful to include the extension in production as well. Usually you can use it for development.

If you want to restrict it there, use redux-devtools-extension/logOnlyInProduction:

javascript
import { createStore } from 'redux';
import { devToolsEnhancer } from 'redux-devtools-extension/logOnlyInProduction';

const store = createStore(reducer, /* preloadedState, */ devToolsEnhancer(
  // options like actionSanitizer, stateSanitizer
));

or with middlewares and enhancers:

javascript
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension/logOnlyInProduction';

const composeEnhancers = composeWithDevTools({
  // options like actionSanitizer, stateSanitizer
});
const store = createStore(reducer, /* preloadedState, */ composeEnhancers(
  applyMiddleware(...middleware),
  // other store enhancers if any
));

You'll have to add 'process.env.NODE_ENV': JSON.stringify('production') in your Webpack config for the production bundle (to envify). If you use create-react-app, it already does it for you.

If you're already checking process.env.NODE_ENV when creating the store, include redux-devtools-extension/logOnly for production environment.

If you don’t want to allow the extension in production, just use redux-devtools-extension/developmentOnly.

See the article for more details.

1.5 For React Native, hybrid, desktop and server side Redux apps

For React Native we can use react-native-debugger, which already included the same API with Redux DevTools Extension.

For most platforms, include Remote Redux DevTools's store enhancer, and from the extension's context menu choose 'Open Remote DevTools' for remote monitoring.

2. Without Redux

See integrations and the blog post for more details on how to use the extension with any architecture.

Docs

  • Options (arguments)
  • Methods (advanced API)
  • FAQ
  • Features
    • Trace actions calls
  • Troubleshooting
  • Articles
  • Videos
  • Feedback

Demo

Live demos to use the extension with:

  • Counter
  • TodoMVC
  • Redux Form
  • React Tetris
  • Book Collection (Angular ngrx store)

Also see ./examples folder.

Backers

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

<a href="https://ope

Issues· 265 open

View all issuesOpen on GitHub
  • #416

    It would be really nice if the tree view browser did alphabetical stable sorting and showed entries in an orderly fashion

    enhancementmonitorUpdated Jul 2, 2025
  • #502

    Can I modify/edit a value manually in redux-devtools without using a reducer?

    Updated Jan 7, 2025
  • #733

    actionSanitizer & stateSanitizer with TypeScript

    Updated Oct 15, 2024
  • #863

    devtool extention issue

    Updated Sep 24, 2024
  • #857

    Redux devtools are blank

    Updated Sep 9, 2024
  • #752

    Allow font-size to be increased

    Updated Apr 16, 2024
  • #799

    trace option not working as-intended

    Updated Jan 11, 2024
  • #862

    Tooltip cut off (overflow: hidden)

    Updated Nov 27, 2023
  • #447

    Multiple instances in dropdown

    Updated Nov 1, 2023
  • #386

    Disable Autoselect Instances?

    Updated Oct 17, 2023

> Tags

JavaScriptdebugdevtoolsextensionjavascript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 2, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具