Jump to content
Search Community

Gsap react target got undefined or not found

Sherlok test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts



I'm not in front of my computer now so there's not a lot I can do from my phone. 


What I can see is that you're not using the useLayoutEffect hook and you're not using GSAP context neither. I recommend you to check the resources in this page:



Also you can see some simple starter templates here where GSAP Context is being used



Finally you should update the versions of both react and GSAP, since the demo is using older ones. Give a try to the approach using GSAP context and the layout effect hook.


Most likely this stems from not using the layout effect hook and the DOM not being rendered when your GSAP code runs.


Hopefully this helps.

Happy Tweening!

Link to comment
Share on other sites

  • Solution



This particular example shows how to use a GSAP timeline with a click handler



This is mostly react related. I recommend you to get a good look at the react page we have and that I linked before and perhaps learn your way around react and how to use event handlers and hooks.



Happy Tweening!

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...