I am making an app in React, I hope to rotate and translate the image once clicked the button.
render: function() {
var imageSrc = this.props.imageSrc;
var rotate = this.props.rotate;
var translate = this.props.translate;
var opacity = this.props.opacity;
var scale = this.props.scale;
return (
<div>
<img src={imageSrc} tyle={{opacity: opacity? 0.5:1,height: scale? 600:300, width: scale? 800:400}}/>
<div>
<input type="file" onChange={this.handleChangeFile} />
</div>
</div>
);
}
});
I set the opacity and scale property in style tag, but I don't know how to add rotate and translate, since there is not html tag for them.
So i made a variable outside of JXS, var imageRotate; if({rotate}===true){ className='rotator'}
return (
<div>
<img src={imageSrc} style={{className={imageRotate}/>
<div>
but it doesn't work. i was wondering what is the best way to pass css into the image tag?