是否可以获得 chrome 控制台警告的堆栈跟踪?

Is it possible to get a stack trace for chrome console warning?

React 在某处警告我错误的状态逻辑:

Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op.

当我点击行号时,它指向 React 源代码中的 console.warn 行。我如何才能看到警告来自我的代码中的哪个位置?有没有办法从 warn 获取堆栈跟踪?

当有超过 20 个不同的组件时,很难追踪。

在查看chrome中的react源代码时,可以点击行号添加断点。

刷新页面后,调试器将在给定行停止,然后通过右侧的调用堆栈,您可以看到您是如何到达那里的。

Google chrome 显示警告的堆栈跟踪:

但铬不会: