Answer the question
In order to leave comments, you need to log in
How to add 2 classes in turn (React)?
I want to implement a function that, when clicked, adds several classes to an element, but does it not all at once, but each class in turn (that is, with a time interval).
I roughly understand how to do this, I use special conditions for if using setTime, but so far, unfortunately, I have not reached the desired result.
Example:
There is an element with class .block
<div>
<div className="block">
</div>
.block {
position: absolute;
top: 0;
width: 50px;
height: 20px;
background-color: #fff;
border-radius: 10px;
transition: all .5s;
}
.first {
top: 60px;
}
.second {
transform: rotate(45deg);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question