Support React Dev Tools
See original GitHub issueHello,
Adding the following in the mount function allows the React Dev Tools to work inside the iframe:
<script>
if (window.parent !== window) {
window['__REACT_DEVTOOLS_GLOBAL_HOOK__'] = window.parent['__REACT_DEVTOOLS_GLOBAL_HOOK__'];
}
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.2.0/umd/react.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.2.0/umd/react-dom.development.js"></script>
Perhaps it’s useful for more people to have it by default.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:12 (7 by maintainers)
Top Results From Across the Web
React Developer Tools
React Developer Tools is a Chrome DevTools extension for the open-source React JavaScript library. It allows you to inspect the React component hierarchies ......
Read more >React Developer Tools - React Docs
Use React Developer Tools to inspect React components, edit props and state, and identify performance problems. You will learn. How to install React...
Read more >How To Debug React Components Using React Developer ...
The React Developer Tools browser extension can help you track down these bugs by giving you more insight into the current state for...
Read more >react-devtools - npm
This package can be used to debug non-browser-based React applications (e.g. React Native, mobile browser or embedded webview, Safari). React ...
Read more >Top 12 React Developer Tools - Extensions & More DevTools
React Developer Tools (known as Devtools) is a Chrome and Firefox extension that adds a set of React-specific inspection widgets to help you ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Instead of saying
window.parent !== window
you should probably just write…if (window.Cypress) { }
@technomage I’ve just checked the @pedroteixeira solution and it works perfectly! I tried it in my own project and in a fresh create-react-app installation, everything works.
For the React DevTools, I’ve added
before che
</head>
of thepublic/index.html
file. For the Redux DevTools I do not need to do anything.To check that everything works, I shared a simple cypress-react-devtools repository. Clone it and follow the instructions to check it the devtools work.