Answer the question
In order to leave comments, you need to log in
How to make delay for each element in React TransitionGroup?
I'm trying to make an animation using ReactTransitionGroup, I want to achieve the effect that the elements appear (pop up) one after another, but it turns out that they appear all together
function Menu(props) {
useEffect(() => {
props.getMenuList()
}, [props.getMenuList])
return (
<div className="row container-fluid mx-0" id="menu">
<TransitionGroup component={null}>
{
props.menu.map(pizza =>
<CSSTransition
key={pizza._id}
timeout={300}
classNames="menuItem">
<Pizza pizzaData={pizza}/>
</CSSTransition>
)
}
</TransitionGroup>
</div>
)
}
<div className="col-3 mt-3">
<div className="container-fluid pizza p-0">
...
</div>
</div>
.menuItem-enter, .menuItem-appear {
opacity: 0;
transform: translateY(30%);
}
.menuItem-enter-active, .menuItem-appear-active {
opacity: 1;
transform: translateY(0%);
transition: opacity 300ms, transform 300ms;
}
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