A zero-config, drop-in animation utility that adds smooth transitions to your web app. You can use it with React, Vue, or any other JavaScript application.
Firstly, thanks for your work on this awesome project! 🙂 This is such a slick way to add animation with almost no effort!
I noticed that useAutoAnimate returns a new setEnabled function every time it's called. This causes unnecessary renders (and effect calls) if other hooks depend on that function.
I believe the solution is to use useCallback so that setEnabled is not re-created unless it has to be. I used patch-package to fix the issue locally - here is the diff that solved it for me:
Hi! 👋
Firstly, thanks for your work on this awesome project! 🙂 This is such a slick way to add animation with almost no effort!
I noticed that
useAutoAnimate
returns a newsetEnabled
function every time it's called. This causes unnecessary renders (and effect calls) if other hooks depend on that function.I believe the solution is to use
useCallback
so thatsetEnabled
is not re-created unless it has to be. I used patch-package to fix the issue locally - here is the diff that solved it for me:This issue body was partially generated by patch-package.