Answer the question
In order to leave comments, you need to log in
How to make smooth removal of an array element with framer-motion?
I made an animation of removal from the array, but it does not work correctly. Shows the removal animation of the last element.
Here's a simple layout I made for ease of viewing.
https://codesandbox.io/s/awesome-edison-75p4t?file...
I would also like to implement a smooth replacement of the deleted element, and not just an unanimated shift.
Answer the question
In order to leave comments, you need to log in
it turned out like this, I added a timeout to the Box so that it had time to animate before deleting
https://codesandbox.io/s/angry-payne-j0nhi
Shows the removal animation of exactly the last element
{boxes.map((item, index) => (
<Box key={index} item={item} onDelete={onDelete} />
))}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question