Jump to content
Search Community

Pin section problem in react

akrdesign

Go to solution Solved by GreenSock,

Recommended Posts

  • Solution
Posted

It looks like you weren't doing proper cleanup in React (React 18+ calls useEffect() TWICE in strict mode, so you'd be creating multiple ScrollTriggers, some of which may be applying to elements that no longer exist because React trashed them). So gsap.context() is your best friend in React - it makes cleanup super easy, plus scoping selector text too: 

https://codesandbox.io/s/pin-using-gsap-in-react-forked-m5ku4c?file=/src/App.js

 

I'd highly recommend reading this article: 

Happy tweening!

  • Like 2

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