Javascript 反应开发工具未在 Chrome 浏览器中加载

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26347489/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-22 22:46:35  来源:igfitidea点击:

react dev tools not loading in Chrome browser

javascriptgoogle-chromereactjs

提问by James Fremen

I'm debugging an application which uses React.js, the Chrome Extensions list clearly shows that the React Developer Tools are installed, and when i access the React site at http://facebook.github.io/react/i can clearly see a "React" tab in the developer tools window. Yet when i'm debugging my application i see this in the console:

我正在调试一个使用 React.js 的应用程序,Chrome 扩展列表清楚地显示已安装 React Developer Tools,当我在http://facebook.github.io/react/访问 React 站点时,我可以清楚地看到开发人员工具窗口中的“React”选项卡。然而,当我调试我的应用程序时,我在控制台中看到了这个:

Download the React DevTools for a better development experience: http://fb.me/react-devtools React.js:87

Download the React DevTools for a better development experience: http://fb.me/react-devtools React.js:87

Can someone tell me how to get it to use the React Developer Tools?

有人能告诉我如何让它使用 React Developer Tools 吗?

thanks!

谢谢!

采纳答案by Brigand

You no longer need to do anything.

您不再需要做任何事情。



For older react versions, the main requirement is that window.React is set. If you're using a module system:

对于较旧的 React 版本,主要要求是设置 window.React。如果您使用的是模块系统:

if (typeof window !== 'undefined') {
    window.React = React;
}

This should usually be done in your main source file.

这通常应该在您的主源文件中完成。

回答by Curtis Yallop

If you opened a local html file in your browser (file://...) then you must first open chrome extensions and check off "Allow access to file URLs".

如果您在浏览器中打开了本地 html 文件 (file://...),那么您必须首先打开 chrome 扩展并勾选“允许访问文件 URL”。

回答by Michelle Tilley

That message always displays, even if the React dev tools are installed and working on the current page. This will be fixed in 0.12 (and is already fixed in master). See https://github.com/facebook/react/pull/953.

即使安装了 React 开发工具并在当前页面上工作,该消息也会始终显示。这将在 0.12 中修复(并且已经在 master 中修复)。见https://github.com/facebook/react/pull/953

回答by Ben

React tools also won't work if you're in incognito mode. Might help someone.

如果您处于隐身模式,React 工具也将无法工作。可能会帮助某人。