DEV Community

Discussion on: Animation Classes & useEffect Hooks - Is There a Better Way?

Collapse
 
josemunoz profile image
José Muñoz

The principle you will be working with is called a spring, it does not have a defined curve or a set duration. In that it differs greatly from the animation you are probably used to. We think of animation in terms of time and curves, but that in itself causes most of the struggle we face when trying to make elements on the screen move naturally, because nothing in the real world moves like that.

react-spring.io

Collapse
 
avatarkaleb profile image
Kaleb M

Hi there,

Thanks for commenting!

Would React Spring be necessary for basic animations or worth including into the bundle? I've heard of it and looks great!

I created a code pen to demo the solution:

codepen.io/avatar-kaleb/pen/voBmzp -- if you want to see the issue, comment out the useEffect hook and you will see that it fades out, then comes right back into view!

Would React Spring help remove this issue without using the hook / setTimeout