In JavaScript, you can get the class name with instance.constructor.name
.
class Demo extends React.Component { componentDidMount(){ console.log(this.constructor.name);
For JSX components, you can use instance.type.displayName
. For instance:
let text = <Text></Text>; console.log(text.type.displayName)
source share