I'm changing(updating) css of a css class when i click on a certain div like follows.
JS part
constructor() {
super();
this.state = {
transform: 'rotateY(0deg)',
};
this.trait_select = this.trait_select.bind(this);
}
trait_select = (e) => {
this.setState({
transform: 'rotateY(180deg)'
})
}
html part
<div className="trait_box polaroid" onClick={this.trait_select}>
<div className="main_trait_card" style={{transform: this.state.transform}}>
</div>
</div>
Now this piece of code work fine. But i want to change the css into transform: 'rotateY(0deg)' if the user clicks on trait_select again. How can i do that?