title: Rotate an image in React
body: <p>I need to rotate an image by 90 degrees in React.
  Here is my code:</p>
  
  <pre><code>rotatePic(id) {
    var newRotation = this.state.rotation + 90;
    if(newRotation &gt;= 360){
      newRotation =- 360;
    }
    this.setState({
      rotation: newRotation,
    });
  }
  
  render() {
    const { rotation } =  this.state;
    const rot = {
      transform: `rotate(${rotation}deg)`
    };
    return (
      &lt;div className="gallery-root"&gt;
        {this.state.images.map(dto =&gt; {
          return &lt;Image 
                   key={'image-' + dto.id} 
                   dto={dto} 
                   galleryWidth={this.state.galleryWidth} 
                   style={{rot}} 
                   width={this.state.width} 
                   height={this.state.height} 
                   imagesArr={this.removePic} 
                   imagesArr2={this.rotatePic}
                 /&gt;;
        })}
    );
  }
  </code></pre>
  
  <p>This doesn't work. Does someone know what am I missing?</p>
  
  <p>Thanks</p>