I have a list of items that can be clicked to show the contents. I need to animate the expanding and collapsing of the contents and I'm currently exploring the Transition component of React Spring.
When an item on the list is clicked, the content is fetched from db and then stored in the component state, only one property (e.g. listContent) is used by all the items therefore the value of listContent changes when another item is clicked.
The animation when the list is expanding works well but my problem is on the exit animation, the content just disappears (if expanded item is clicked to collapse) or is updated with the new state (if another item is clicked). I can't share the actual code, but I made a similar one here
It's my first time asking here, I hope my question is clear enough. Please let me know if any other info is needed. TIA!