Class Components
You can use this.constructor.name
to obtain the name of your component.
(Using React 16.x as of this writing)
Caveat: This won’t work if you’re minifying for production with Webpack.
Functional Components
https://reactjs.org/docs/react-component.html#displayname