How to animate on new state? - React

Hello, at the moment, I have an animation which only occurs when the component renders, however, I want to display the animation every time the state changes, so the change of the quote doesn’t seem so abrupt.

You can check my application here to see what I’m talking about.

I haven’t been able to find the way to display that animation when I get a new quote, do you have any ideas?


You can use componentDidUpdate (), or you can update the component changing the key prop ( for example the key can be a boolean value and you can toggle the value everytime you need an update ), or maybe you can use react animation

I’ve been trying to use react animation, but I can’t manage to animate on state change, I have been looking for an example but no luck so far.

Have you tried with componentDidUpdate () ?

Hey Oxyrus have you found a solution to that problem of yours? i’m facing the same problem :frowning:

No, I haven’t been able to find a solution.