How can I dynamically add/remove classes to img tag. Basically I want to change my image automatically after every 2 seconds just like Instagram signup page. But I don't know how to do it using material-ui approach. Here is my code I want to add certain classes and remove them periodically.
<div className={classes.phoneImageWrapper}>
<img src={Phone1} alt="instagram" className={classes.phoneImage} />
<img src={Phone2} alt="instagram" className={classes.phoneImage} />
<img src={Phone3} alt="instagram" className={classes.phoneImage} />
<img src={Phone4} alt="instagram" className={classes.phoneImage} />
<img src={Phone5} alt="instagram" className={classes.phoneImage} />
</div>
and here is my styles I want to add/remove phoneImageAnimation and phoneImageVisible to img after every 2 seconds
phoneImageWrapper: {
margin: "10px 0 0 151px",
position: "relative",
},
phoneImage: {
top: 100,
left: 0,
position: "absolute",
width: 240,
height: 427,
opacity: 0,
visibility: "hidden",
},
phoneImageAnimation: {
transition: "opacity 1.5s ease-in",
zIndex: 2,
},
phoneImageVisible: {
opacity: 1,
visibility: "visible",
}
