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