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 component which called it.
Here is how i call my Loading component (with this.state.displayLoading at true or false) :
class LoginForm extends React.Component {
render() {
return (
<div className="login-form-root">
{this.state.displayLoading && <Loading loadingFrom={?}/>}
</div>
);
}
}
I want to get "LoginForm" in my variable loadingFrom, which is the className. Maybe it's not the right way to do that.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…