Dealing with animations can make a simple component become complex that it loses its main qualities: atomicity, reusability, testability, composability to name a few.
Libraries like react-spring came to make animations a more pleasant and fun task to do. However, it does not prevent the code from becoming more complex, difficult to read and test.
One of the last experiences that forced me to think about how to separate animation behavior from presentational logic was the SteppedSlider component whose purpose is to display any set of elements that are provided as children, also giving them the ability to slide them as a carousel. …