电子-如何添加React开发工具 [英] Electron - How to add react dev tool
问题描述
将react dev工具添加到电子窗口的简单方法是什么?我尝试添加扩展哈希
What is the easy way to add react dev tool to electron window? I try add the extension hash
BrowserWindow.addDevToolsExtension('path / to / extension / ade2343nd23k234bdb')。15.01
但是当扩展名更新时,我不得不手动更新main.js中的字符串。我正在寻找更好的方法。
But when the extension update, I had to manually update the string in main.js. I'm looking for a better way.
推荐答案
这是电子< = 1.2.1版本的解决方案
Here is a Solution for Electron <= 1.2.1 version
1-在您的应用程序文件夹中
1- In your app folder
npm install --save-dev electron-react-devtools
2-打开您的电子应用程序,单击(查看/切换开发人员工具)。在控制台标签中,插入以下代码,然后按Enter键:
2- Open your electron app, click on (view/toggle developer tools). In the console tab insert the following code and hit enter:
require('electron-react-devtools').install()
3-重新加载/刷新电子应用页面上,您会看到react dev工具出现。
3- Reload/refresh your electron app page and you'll see the react dev tools appear.
4-完成!
看下面的屏幕截图
这篇关于电子-如何添加React开发工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!