Answer the question
In order to leave comments, you need to log in
Why doesn't CSSTransition work?
I'm trying to animate one element in react. I looked at an example from the CSSTransition documentation. Poshamanil a bit with styles, but the animation does not work
<button onClick={() => seIsVisibility(!isVisibility)}>{isVisibility.toString()}</button>
<CSSTransition
in={isVisibility}
timeout={2000}
classNames={"alert"}
>
<div className={cl.box}>{isVisibility.toString()}</div>
</CSSTransition>
.box {
width: 100px;
height: 100px;
margin: 50px;
text-align: center;
}
.alert-enter {
background-color: teal;
}
.alert-enter-active {
background-color: red;
transition: background-color 2000ms ease-in;
}
.alert-enter-done {
background-color: red;
}
.alert-exit {
background-color: red;
}
.alert-exit-active {
background-color: teal;
transition: background-color 2000ms ease-in;
}
.alert-exit-done {
background-color: teal;
}
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