- from Chrome Web Store;
- 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
.
- 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).
- just specify
REDUX_DEVTOOLS
inelectron-devtools-installer
.
Note that starting from v2.7,
window.devToolsExtension
was renamed towindow.__REDUX_DEVTOOLS_EXTENSION__
/window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
.
For a basic Redux store simply add:
const store = createStore(
reducer, /* preloadedState, */
+ window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
);
Note that preloadedState
argument is optional in Redux' createStore
.
For universal ("isomorphic") apps, prefix it with
typeof window !== 'undefined' &&
.
In case ESLint is configured to not allow using the underscore dangle, wrap it like so:
+ /* 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).
If you setup your store with middleware and enhancers, change:
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:
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);
To make things easier, there's an npm package to install:
npm install --save redux-devtools-extension
and to use like so:
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:
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
const composeEnhancers = composeWithDevTools({
// Specify here name, 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
:
import { createStore } from 'redux';
import { devToolsEnhancer } from 'redux-devtools-extension';
const store = createStore(reducer, /* preloadedState, */ devToolsEnhancer(
// Specify here name, actionsBlacklist, actionsCreators and other options if needed
));
It's useful to include the extension in production as well. Usually you can use it as for development.
If you want to restrict it there, use redux-devtools-extension/logOnlyInProduction
:
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:
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 usecreate-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 enviroment.
If you don’t want to allow the extension in production, just use redux-devtools-extension/developmentOnly
.
See the article for more details.
Include Remote Redux DevTools
's store enhancer, and from the extension's context menu choose 'Open Remote DevTools' for remote monitoring.
See integrations and the blog post for more details on how to use the extension with any architecture.
- Options (arguments)
- Methods (advanced API)
- Create Redux store for debugging.
- FAQ
- Troubleshooting
- Articles
- Videos
- Feedback
Live demos to use the extension with:
Also see ./examples
folder.
Support us with a monthly donation and help us continue our activities. [Become a backer]
Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]
MIT
If you like this, follow @mdiordiev on twitter.