Redux DevTools
It is possible to debug store changes using the Redux DevTools. 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.
Enable DevToolsβ
We have a middleware to enable Redux DevTools on your store. Your store should be wrapped with withDevTools
, otherwise the it will not work as expected. Here Counter Store
is a store identifier for the Redux DevTools.
import { createStore, withDevTools } from '@poly-state/poly-state';
import { useStore } from '@poly-state/react';
const counterStore = createStore({ count: 0 });
withDevTools(counterStore, 'Counter Store');
const useCounterStore = () => useStore(counterStore);
Conditionally Enableβ
import { createStore, withDevTools } from '@poly-state/poly-state';
import { useStore } from '@poly-state/react';
const counterStore = createStore({ count: 0 });
if (process.env.NODE_ENV === 'development') {
withDevTools(counterStore, 'Counter Store');
}
const useCounterStore = () => useStore(counterStore);
Install Redux DevToolsβ
1. For Chromeβ
- from Chrome Web Store;
- or download
extension.zip
from last releases, unzip, openchrome://extensions
url and turn on developer mode from top left and then click; onLoad 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
inelectron-devtools-installer
.
4. For other browsers and non-browser environmentβ
For more information, see Redux DevTools documentation.