react-devtools
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesereact-devtools
react-devtools
Use this skill when the task needs React Native internals that are not visible in the accessibility tree: component hierarchy, props, state, hooks, render causes, or profiling data.
Run commands through . The command dynamically runs pinned and passes arguments through 1:1.
agent-device react-devtoolsagent-react-devtools@0.4.0The first run may download the pinned package from npm. global flags work before or after ; use before downstream flags only when they intentionally share an global flag name.
agent-devicereact-devtools--agent-device当任务需要查看无障碍树中不可见的React Native内部信息(如组件层级、props、state、hooks、渲染原因或分析数据)时,使用此skill。
通过运行命令。该命令会动态运行固定版本的,并直接传递所有参数。
agent-device react-devtoolsagent-react-devtools@0.4.0首次运行时可能会从npm下载固定版本的包。全局标志可以放在之前或之后;只有当下游标志与全局标志名称重复时,才需要在下游标志前添加。
agent-devicereact-devtoolsagent-device--Default flow
默认流程
- Use to open the React Native app and verify the visible state when needed.
agent-device - Check .
agent-device react-devtools status - If no app is connected, start or wait for the devtools daemon, then reload or relaunch the app.
- Inspect with ,
get tree, andfind.get component - Profile only around the interaction being investigated.
- Verify the fix with the same command sequence and interaction.
For cross-platform validation with explicit , , or selectors, prefer an isolated over separate named sessions. Named sessions enable bound-session locks during setup. Restart between iOS and Android runs so , , and profiling clearly refer to the currently launched app.
--device--udid--serial--state-diragent-device react-devtoolsstatusget tree- 使用打开React Native应用,必要时验证其可见状态。
agent-device - 执行检查状态。
agent-device react-devtools status - 如果没有应用连接,启动或等待devtools守护进程,然后重新加载或重启应用。
- 使用、
get tree和find命令进行检查。get component - 仅针对正在调查的交互过程进行性能分析。
- 使用相同的命令序列和交互操作验证修复效果。
对于使用显式、或选择器的跨平台验证,优先使用独立的而非单独的命名会话。命名会话会在设置期间启用绑定会话锁。在iOS和Android运行之间重启,以便、和性能分析明确指向当前启动的应用。
--device--udid--serial--state-diragent-device react-devtoolsstatusget treeMain commands
主要命令
bash
agent-device react-devtools status
agent-device react-devtools wait --connected
agent-device react-devtools get tree --depth 3
agent-device react-devtools find <ComponentName>
agent-device react-devtools get component @c5
agent-device react-devtools profile start
agent-device react-devtools profile stop
agent-device react-devtools profile slow --limit 5
agent-device react-devtools profile rerenders --limit 5bash
agent-device react-devtools status
agent-device react-devtools wait --connected
agent-device react-devtools get tree --depth 3
agent-device react-devtools find <ComponentName>
agent-device react-devtools get component @c5
agent-device react-devtools profile start
agent-device react-devtools profile stop
agent-device react-devtools profile slow --limit 5
agent-device react-devtools profile rerenders --limit 5Decision rules
决策规则
- Need current UI text, refs, screenshots, logs, network, or device metrics: use the skill.
agent-device - Need props, state, hooks, component ownership, render causes, or React profiler data: use this skill.
- Start component-tree reads with or
get tree --depth 3to keep output bounded.find <name> - Labels like reset when the app reloads or components remount. After reload, run
@c5and inspect again.wait --connected - Profiling only captures renders between and
profile start.profile stop - On Android, set for React DevTools. If Metro is local, also set
adb reverse tcp:8097 tcp:8097.adb reverse tcp:8081 tcp:8081
- 需要当前UI文本、引用、截图、日志、网络或设备指标:使用skill。
agent-device - 需要props、state、hooks、组件归属、渲染原因或React性能分析数据:使用本skill。
- 从或
get tree --depth 3开始读取组件树,以控制输出范围。find <name> - 类似的标签会在应用重新加载或组件重新挂载时重置。重新加载后,运行
@c5并再次检查。wait --connected - 性能分析仅捕获和
profile start之间的渲染操作。profile stop - 在Android上,需设置以使用React DevTools。如果Metro在本地运行,还需设置
adb reverse tcp:8097 tcp:8097。adb reverse tcp:8081 tcp:8081
References
参考资料
| File | When to read |
|---|---|
| commands.md | Command reference and common inspection flows |
| profiling.md | Render profiling workflow and interpretation |
| 文件路径 | 阅读场景 |
|---|---|
| commands.md | 命令参考和常见检查流程 |
| profiling.md | 渲染性能分析流程与解读 |