Jump to content
Search Community

Animation works and then disappears automatically

KidNinja test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

  • Solution

Welcome to the forums, @KidNinja

 

It looks like you just aren't doing proper cleanup. In React 18, useEffect() is actually called TWICE. So you're inadvertently creating duplicate/competing animations. That's why gsap.context() is your new best friend in React - please read this article: 

 

It makes cleanup super easy.

 

Is this what you were looking for?: 

https://codesandbox.io/s/silent-surf-gm3896?file=/src/App.js

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...