gsap-react

Integrate GreanSock animations into React and Next.js apps using the useGSAP hook with automatic cleanup on unmount.

13.3k|785|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/greensock/gsap-skills --skill gsap-react-greensock
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-react
Source: https://github.com/greensock/gsap-skills/tree/main/skills/gsap-react
Command: npx skills add https://github.com/greensock/gsap-skills --skill gsap-react-greensock

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps users implement and manage animations in React and Next.js applications, making GSAP animations accessible and maintainable without complex configurations.

Core Features & Use Cases

  • UseGSAP Hook: Streamline GSAP animation setup with the useGSAP hook.
  • Scope and Cleanup: Safely scope animations and automatically clean up on unmount.
  • React Context: Access GSAP context for animation-related tasks in a React component.
  • Use Case: A React developer is implementing animations for a carousel and wants to use GSAP without worrying about manual cleanup and side effects.

Quick Start

Import and use the useGSAP hook from the GSAP React library in your component to create animations with automatic cleanup.

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 causing memory leaks on unmount?

The useGSAP hook handles GSAP context setup and teardown automatically, scoping animations safely and cleaning up resources on component unmount to prevent memory leaks without manual configuration.

Can I use the useGSAP hook in a Next.js application?

Yes, the useGSAP hook integrates GreenSock animations into both React and Next.js applications, allowing smooth component animations while maintaining a clean codebase.

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

Using the useGSAP hook scopes GSAP animations safely to specific React components by managing React Context automatically, ensuring animations remain contained without manual cleanup.

Do I need to manually clean up GSAP timelines when a React component unmounts?

No, the useGSAP hook handles the teardown automatically on component unmount, cleaning up GSAP timelines and contexts without manual intervention to maintain a clean codebase.

Does GSAP React handle the React Context setup required for complex animations?

Yes, GSAP React handles React Context setup automatically. The useGSAP hook provides access to the GSAP context needed for animation-related tasks within React components.