[React] Animate a component on prop change

Hi there !

I am struggling with some animations in React :’(. I made a quick demo to illustrate :

Here I am using react-transition-group and animeJS.

I have a Title component and I would like to animate it on prop change. The thing is that I want to trigger the exit animation gracefully when the prop is about to change, but as I noticed, this can only be triggered when the in property is false.

Is there another way to trigger it ?

Thanks for your replies !