Мне нужно повернуть изображение на 90 градусов в React.Вот мой код:
rotatePic(id) {
var newRotation = this.state.rotation + 90;
if(newRotation >= 360){
newRotation =- 360;
}
this.setState({
rotation: newRotation,
});
}
render() {
const { rotation } = this.state;
const rot = {
transform: `rotate(${rotation}deg)`
};
return (
<div className="gallery-root">
{this.state.images.map(dto => {
return <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}
/>;
})}
);
}
Это не работает.Кто-то знает, что мне не хватает?
Спасибо