Skip to content

Instantly share code, notes, and snippets.

@brunosabot
Created March 15, 2020 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunosabot/02fd13b082f19105005818b3ef166139 to your computer and use it in GitHub Desktop.
Save brunosabot/02fd13b082f19105005818b3ef166139 to your computer and use it in GitHub Desktop.
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