我是 reactjs 的新手。
在这里,我试图在一个按钮上显示一个微调器,就像
<button type="submit"
style={{ fontWeight: 'bold', marginTop: 10 }}
className="btn btn-primary btn-block"
onClick={(event) => this.handleClick(event)}>
{<i class="fa fa-spinner fa-spin"></i> && this.state.isloading}
Login
</button>
现在,这里,
constructor(props) {
super(props);
this.state = {
userName: '',
passWord: '',
isloading: false
}
}
componentWillReceiveProps(newProps) {
if (newProps.clickedLogin) {
this.setState({
isloading: true
});
}
}
所以,当用户点击按钮时,我正在调度一个动作,然后我得到一个使用 mapStateTOProps 的道具。
但是现在,当我单击按钮时,它没有显示该微调器。
谁能帮我这个?