I have an array of questions and I am trying to transition how each question moves to the next.
The transition works for the 1st question, but does not for the 2nd, 3rd etc.
I am asking the CSSTransition to start (in) at the first question. Any thoughts as to why this may not be working?
const [currentQuestion, setCurrentQuestion] = useState(0);
...
<div className={css.questionsContainer}>
<CSSTransition
in={currentQuestion}
classNames="alert"
timeout={300}
>
<Paragraph large className={css.questions}>
{internationalOnboardingQuestions[currentQuestion].questionText}
</Paragraph>
</CSSTransition>
</div>
.alert-enter {
opacity: 0;
transform: scale(0.9);
}
.alert-enter-active {
opacity: 1;
transform: translateX(0);
transition: opacity 300ms, transform 300ms;
}
.alert-exit {
opacity: 1;
}
.alert-exit-active {
opacity: 0;
transform: scale(0.9);
transition: opacity 300ms, transform 300ms;
}