gsap-react

Integrate GSAP animations into React and Next.js with useGSAP hook and ref scoping.

26|4|Updated Jul 21, 2026
One-click install
npx skills add https://github.com/skyf0xx/hedgehog --skill gsap-react-skyf0xx
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-react
Source: https://github.com/skyf0xx/hedgehog/tree/main/skills/GSAP/gsap-react
Command: npx skills add https://github.com/skyf0xx/hedgehog --skill gsap-react-skyf0xx

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gsap, @gsap/react.

What problem does it solve?

This skill solves the common challenges of integrating GSAP animations into React, such as memory leaks, improper cleanup on unmount, and SSR-related execution errors.

Core Features & Use Cases

  • Automatic Cleanup: Leverages the useGSAP hook to ensure animations and ScrollTriggers are reverted when components unmount.
  • Scope Management: Provides patterns for scoping animations to specific DOM elements using refs, preventing global selector conflicts.
  • Context Safety: Offers contextSafe wrappers for event-driven animations to ensure they remain manageable within the React lifecycle.

Quick Start

Use the gsap-react skill to implement a GSAP animation within a React component using the useGSAP hook and proper ref scoping.

Frequently Asked Questions about gsap-react

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

FAQPage Schema
How do I prevent memory leaks when using GSAP animations in React components?

To prevent memory leaks with GSAP animations in React, use the useGSAP hook to automatically revert animations and ScrollTriggers when components unmount. This manages the React component lifecycle by ensuring proper cleanup of GSAP instances.

How do I scope GSAP animations to specific DOM elements in React?

Scope GSAP animations to specific DOM elements in React by using refs. This skill provides patterns for scoped selector targeting, preventing global selector conflicts and ensuring animations only affect the intended component elements within your application.

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

Yes, GSAP works with Next.js and server-side rendering. This skill satisfies SSR compatibility requirements by managing component lifecycles and DOM refs, preventing execution errors during server-side rendering while integrating GSAP animations into Next.js applications.

What is the best way to handle event-driven GSAP animations in React?

The best way to handle event-driven GSAP animations in React is using contextSafe wrappers. This skill offers contextSafe patterns to ensure event-driven animations remain manageable within the React lifecycle, preventing scope and cleanup issues during interactive component states.

Why does my GSAP ScrollTrigger break when a React component unmounts?

GSAP ScrollTrigger breaks on unmount because animations are not properly cleaned up. This skill leverages the useGSAP hook for automatic cleanup, ensuring ScrollTriggers are reverted when components unmount to prevent execution errors and memory leaks.