


UseLayoutEffect (() =>, ) // <- empty dependency Array so it doesn't re-run on every render //. ntext makes cleanup nice and simple, all GSAP animations and ScrollTriggers created within the function get collected up so that you can easily revert() ALL of them at once.Ĭonst comp = useRef () // create a ref for the root level element (for scoping) const circle = useRef () This pattern follows React's best practices. Proper animation cleanup is crucial to avoid unexpected behaviour with React 18's strict mode. Need some extra help? Hit up the Reactiflux community for expert advice. That being said - there are some React-specific tips and techniques that will make your life easier! GSAP is a framework-agnostic animation library, that means that you can write the same GSAP code in React, Vue, Angular or whichever framework you chose, the core principles won't change.
