I have simple react app that contains 3 components: app, ul and li. The app holds an array of items. Every 5 seconds (with set interval) the app slices 3 consecutive items and send them to the ul component to be displayed. If we start with:
after 5 seconds the list will be:
I'm trying to create an animation that once the props to the ul are updated, will push down the current list, until the bottom item is hidden, and after that it the next item should appear on top. I thought about using the getDerivedStateFromProps method to activate the animation, use async await to hold the app until the animation will end (translateY) and then apply another animation of opacity on the new item. I don't think it's a good solution and I think there must be simpler way to do it. I also tried using the react transition group, but it only works when the item appear and not when content is changing. I would love if anyone could point me in the right direction.