Skip to content

Instantly share code, notes, and snippets.

@brunosabot
Created March 15, 2020 12:43
const ReduxDevtoolsProvider = ({ children }) => {
const withDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__;
let devTools;
useEffect(() => {
if (withDevTools) {
devTools = window.__REDUX_DEVTOOLS_EXTENSION__.connect();
devTools.init();
return () => {
window.__REDUX_DEVTOOLS_EXTENSION__.disconnect();
};
}
return () => {};
});
return children;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment