gsap-react

Implements GSAP animations in React using the useGSAP hook, scoped refs, and context cleanup.

Updated Jun 9, 2026
One-click install
npx skills add https://github.com/TOBIASpuchito/Citec --skill gsap-react-tobiaspuchito
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gsap-react
Source: https://github.com/TOBIASpuchito/Citec/tree/main/citec-frontend/.claude/skills/gsap-react
Command: npx skills add https://github.com/TOBIASpuchito/Citec --skill gsap-react-tobiaspuchito

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gsap, @gsap/react.

What problem does it solve? GSAP animations in React often leak memory, target wrong elements across re-renders, or break during server-side rendering. This Skill provides the correct patterns for integrating GSAP with React and Next.js so animations are scoped, cleaned up on unmount, and run only on the client. ## Core Features & Use Cases - useGSAP Hook Patterns: Set up animations with the @gsap/react useGSAP hook, including scope, dependency arrays, and revertOnUpdate configuration. - Cleanup and Context Safety: Use gsap.context() with ctx.revert() in useEffect, and wrap event-handler callbacks with contextSafe so animations created after setup are still reverted. - SSR-Safe Usage: Keep all GSAP and ScrollTrigger code inside client-only lifecycles for Next.js and other SSR frameworks. - Use Case: You are building a Next.js landing page and want staggered entrance animations on a component. This Skill guides you to register useGSAP, pass a container ref as scope, and let cleanup run automatically on unmount. ## Quick Start Ask the AI to add a GSAP fade-in animation to a React component using the useGSAP hook with a scoped container ref.

Frequently Asked Questions about gsap-react

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use GSAP animations in a React component?▼

Use the useGSAP hook from @gsap/react instead of useEffect. Register it with gsap.registerPlugin(useGSAP), then place your GSAP code inside the hook and pass a container ref as the scope so selectors only match elements within that component.

How do I clean up GSAP animations on React unmount?▼

The useGSAP hook reverts animations and ScrollTriggers automatically on unmount. If you use gsap.context() inside a regular useEffect, return a cleanup function that calls ctx.revert() to kill tweens and restore inline styles.

Does GSAP work with Next.js server-side rendering?▼

GSAP runs only in the browser, so never call gsap or ScrollTrigger during SSR. Place all GSAP code inside useGSAP or useEffect so it executes client-side only, and consider dynamic imports if bundle size is a concern.

Why do my GSAP animations leak or fire on unmounted components?▼

Animations created inside event handlers after useGSAP runs are not added to its context, so they are never reverted. Wrap those callbacks with the contextSafe function returned by useGSAP and remove event listeners in the cleanup function.

Should I use useGSAP or useEffect with gsap.context?▼

Prefer useGSAP from @gsap/react because it handles cleanup automatically and provides scope and contextSafe. Use gsap.context() inside useEffect only when @gsap/react is unavailable or you need specific effect dependency behavior, and always call ctx.revert() in cleanup.