For reference, check out this StackBlitz Link
I have css animation @keyframes
class..
/*
Animation classes.
*/
.example-enter {
animation: flasher 0.5s;
}
@keyframes flasher{
from {
opacity: 0.2;
}
to {
opacity: 1;
}
}
I am applying this .example-enter
css class to div when array.map
is having new added data. like below..
<div className="example-enter"> ... </div>
The question is when I added new Array to state, react will create new div, and gives animation to last added div only. But I want very first element to be animated, not last one when added new state to array.
You can check out demo in above stackblitz link to check out more details and see there when we add new list only last div is animated but i want to animate very first element to animate because that first div element is i added to array. using.. setTodoState( prev => [newTodoState, ...prev ]);