gsap-react

Integrate GSAP animations in React/Next.js with SSR-compatible useGSAP and contextSafe hooks.

3|2|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/woxiangyangzhimao/skills --skill gsap-react-woxiangyangzhimao
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-react
Source: https://github.com/woxiangyangzhimao/skills/tree/main/gsap-react
Command: npx skills add https://github.com/woxiangyangzhimao/skills --skill gsap-react-woxiangyangzhimao

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill addresses the complexities of integrating GSAP for animations in React, simplifying SSR compatibility and avoiding common pitfalls with context management and lifecycle events.

Core Features & Use Cases

  • SSR Compatible GSAP: Handles server-side rendering concerns, ensuring that animations work consistently across the web.
  • Ref and Scope Management: Utilizes React hooks for managing GSAP animations within component lifecycles, ensuring safe cleanup and efficient execution.
  • ContextSafe Callbacks: Ensures that event handlers are safely detached from the context, preventing potential memory leaks and unnecessary re-rendering issues.
  • Use Case: Enhance React components with high-performance animations while maintaining SEO-friendly practices for server-side rendering.

Quick Start

Add the 'gsap-react' skill to your React application. Set up your GSAP animations with the useGSAP() hook and manage them within the component lifecycle.

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 React without breaking server-side rendering?

To use GSAP animations in React without breaking server-side rendering, utilize the useGSAP hook to manage animations within the component lifecycle, ensuring DOM updates are deferred safely to the client side and maintain SSR compatibility across your Next.js application.

Why does my GSAP animation cause memory leaks in React?

GSAP animations cause memory leaks in React when event handlers are not properly detached. Using contextSafe callbacks ensures handlers are safely scoped within the GSAP context, preventing memory leaks and unnecessary re-rendering issues during component unmounting.

Can I use GSAP with Next.js for SEO-friendly animated components?

Yes, you can use GSAP with Next.js for SEO-friendly animated components by implementing server-side and client-side GSAP animation strategies. This approach ensures consistent rendering output while maintaining SEO-friendly practices for server-side rendered content.

What is the best way to manage GSAP refs and scope in a React component?

The best way to manage GSAP refs and scope in a React component is by utilizing dedicated React hooks like useGSAP. This handles GSAP animations within component lifecycles, ensuring safe cleanup, efficient execution, and proper scope management automatically.

How to prevent GSAP animation re-rendering issues in React?

To prevent GSAP animation re-rendering issues in React, use contextSafe callbacks to safely detach event handlers from the context. Combined with proper ref and scope management via useGSAP, this prevents unnecessary re-rendering and potential memory leaks effectively.