react怎样打印出父组件的名称?

在项目中,由于组件非常多,经常碰到this.props,想通过console.log快速找到父组件。

阅读 2.2k
1 个回答
// 在继承了Component 里的 Class 里面
console.log(this._reactInternalFiber._debugOwner.type.name)
推荐问题