I\'m developing a React application. I have a Loading component, which is a little animation for waiting. I want to add a message in this Loading component according to the
You don't need it to be dynamic since you are writing the component yourself and can pass it as a string
class LoginForm extends React.Component {
render() {
return (
{this.state.displayLoading && }
);
}
}
However if you still need to access the name of the component, you could define the displayName property on the component
class LoginForm extends React.Component {
static displayName = 'LoginForm';
render() {
return (
{this.state.displayLoading && }
);
}
}
and access it like Component.displayName.