Jump to content
GreenSock

Muhammad Abdullah

Scrolltrigger plugin registration in muliple ReactJs Components.

Recommended Posts

Hi GSAPians,

I'm working on a landing page using GatsbyJs + GSAP. I've multiple sections in which I wanna apply the animations on scroll using scrollTrigger.

so, I wanna know the best practice to register the scrollTrigger plugin when It's has to be used in multiple sections.
Do I've to register it in each section's component?
OR
Is there any way to register it on one place and then use it in any section or component I want?


Thanks
 

Link to comment
Share on other sites

6 hours ago, Muhammad Abdullah said:

Is there any way to register it on one place and then use it in any section or component I want?

 

I would recommend to register everything in a single file. From there, you just export what you might need in other files. Check out the gsap.js file here.

https://codesandbox.io/s/gsap-plugin-registration-yj511?file=/src/gsap.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.
×