gsap-react

Manage GSAP animations in React components with automatic cleanup and scoping.

Updated Jun 7, 2026
One-click install
npx skills add https://github.com/yequdesu/Main-Page --skill gsap-react-yequdesu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-react
Source: https://github.com/yequdesu/Main-Page/tree/main/.pi/skills/gsap-react
Command: npx skills add https://github.com/yequdesu/Main-Page --skill gsap-react-yequdesu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gsap, @gsap/react, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill enables React developers to implement high-quality animations within their components using GreenSock's GSAP library, simplifying the animation process and reducing the complexity of animations in React applications.

Core Features & Use Cases

  • UseGSAP() Hook: Provides a convenient hook for managing GSAP animations with automatic cleanup.
  • Scope and Refs: Ensures that animations are scoped correctly and targets are identified through references, reducing unintended interactions with external elements.
  • Context Safe Callbacks: Wraps callback functions to ensure they do not cause issues after the component has unmounted.
  • Server-Side Rendering Guidance: Ensures GSAP animations only run on the client-side, avoiding issues with server-side rendering.

Quick Start

Animate a React component using the GSAP with React skill by following this command: Use the gsap-react skill to animate a React component with GSAP.

Frequently Asked Questions about gsap-react

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

FAQPage Schema
How do I animate React components with GSAP without causing memory leaks?

You can animate React components with GSAP using the useGSAP() hook, which provides automatic cleanup of animations. This prevents memory leaks by ensuring setup, scope management, and context safe callbacks are handled correctly during unmount.

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

Yes, GSAP works with Next.js and server-side rendering by ensuring animations only run on the client-side. Following server-side rendering guidance prevents hydration mismatches and avoids errors during initial server rendering.

What is the best way to scope GSAP animations to specific React components?

The best way to scope GSAP animations in React is by using references within the useGSAP() hook. This correctly scopes animations to specific elements and reduces unintended interactions with external DOM nodes.

Why do my GSAP animations break after a React component unmounts?

GSAP animations break after unmounting if cleanup is not handled properly. Using the useGSAP() hook and context-safe callbacks ensures animation timelines are destroyed and do not cause issues after the React component unmounts.

Do I need to install @gsap/react to use GSAP in React?

Yes, you need to install both the gsap library and the @gsap/react package. These dependencies provide the optimized GSAP experience and the specific React integration hooks required for animating components.