📅  最后修改于: 2022-03-11 15:01:59.905000             🧑  作者: Mango
class Utilitybar extends React.Component {
constructor(props) {
super(props)
this.onButtonClicked = this.onButtonClicked.bind(this)
this.state = { currentButton: null }
}
onButtonClicked (id) {
this.setState({ currentButton: this.state.currentButton === id ? null : id })
}
render(){
return (
this.onButtonClicked(0)}>
this.onButtonClicked(1)}>
);
}
}