Jump to content
Search Community

No Issues Just Some Queries

blizve0 test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

  • Solution

Hi @blizve0

 

Have you check out our React guides?

 

 

The Imperative Communication section talks about how using React mechanisms, like changing state can be bad for performance as it causes re-renders. I think it would make more sense to put everything inside a single effect...

 

useEffect(() => {
    
    const onMove = ({ x, y }) => {
      gsap.to(".cursor", {
        duration: (i) => 1.8 - i * 0.2,
        stagger: 0.05,
        x, 
        y
      })
    }
    
    window.addEventListener("mousemove", onMove);
    
    return () => window.removeEventListener("mousemove", onMove)    
  }, []);

 

  • Like 1
  • Thanks 1
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...