GSAP/gsap-react — Agent Skills | officialskills.sh
Back to skills

gsap-react

communitydevelopment

Covers GSAP animation setup in React and Next.

Setup & Installation

npx skills add https://github.com/greensock/gsap-skills --skill gsap-react
or paste the link and ask your coding assistant to install it
https://github.com/greensock/gsap-skills/tree/main/skills/gsap-react
View on GitHub

What This Skill Does

Covers GSAP animation setup in React and Next.js using the useGSAP hook, gsap.context(), and ref-based targeting. Handles cleanup on unmount, scoped selectors, context-safe callbacks, and SSR safety. Works with the broader GSAP ecosystem including ScrollTrigger and timelines.

Using useGSAP instead of raw useEffect eliminates manual ctx.revert() calls and prevents the animation leaks and stale-node warnings that come from skipping cleanup.

When to use it

  • Animating components on mount with automatic cleanup when they unmount
  • Scoping GSAP selectors to a single component so they don't match DOM outside it
  • Wrapping click handlers in contextSafe so animations stop firing after unmount
  • Running GSAP animations in Next.js without triggering errors during server render
  • Managing timeline cleanup across re-renders using revertOnUpdate