简体   繁体   English

React 开发工具不显示组件名称或 State 变量名称

[英]React Dev Tools does not show Component Names or State Variable Names

This is a screenshot of the new React Dev Tools in Google Chrome:这是 Google Chrome 中新的 React 开发工具的截图:

反应开发工具

Only the top level component name AdminArea shows.仅显示顶级组件名称AdminArea This component is in my script's entry file, index.jsx .该组件位于我脚本的入口文件index.jsx中。 There should also be AddNewCoupon and ViewCoupons components.还应该有 AddNewCoupon 和 ViewCoupons 组件。 No filters are enabled.没有启用过滤器。

Notice also the state hook naming inside the component only says "State".另请注意,组件内的 state 挂钩命名仅表示“状态”。 These are booth useState() hooks.这些是展位 useState() 挂钩。

The useReducer's initial state variable names can be seen, but only because I'm directly exporting and importing that variable into the entry file index.jsx .可以看到 useReducer 的初始 state 变量名称,但这只是因为我直接将该变量导出并导入到入口文件index.jsx中。

Anyone know how to fix these labelling issues?有人知道如何解决这些标签问题吗?

Actually there's no current solution to this problem I was going to open a Github issue about this but it turned out that Bryan Vaughn opened the issue himself:).实际上,目前还没有解决这个问题的方法,我打算为此打开一个 Github 问题,但结果是 Bryan Vaughn 自己打开了这个问题:)。 Here is the reference to Github issue .这是对Github 问题的参考。 Cheers, sigfried.干杯,西格弗里德。

Update更新

Now it's possible to show the names within the DevTools, click the magic wand in the top right corner:现在可以在 DevTools 中显示名称,单击右上角的魔术棒: 点击魔法棒按钮

And that will become:那将变成: 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM