gsap-react

Create React GSAP animations with useGSAP, scoped containers, and automatic cleanup.

Updated Apr 28, 2026
One-click install
npx skills add https://github.com/tututwo/heather-birthday-itenary --skill gsap-react-tututwo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-react
Source: https://github.com/tututwo/heather-birthday-itenary/tree/main/.agents/skills/gsap-react
Command: npx skills add https://github.com/tututwo/heather-birthday-itenary --skill gsap-react-tututwo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Streamlines creating robust, unmount-safe GSAP animations in React by providing a hook-based pattern, scoped selectors, and automatic cleanup.

Core Features & Use Cases

  • useGSAP() hook to configure animations within a scoped container and ensure cleanup on unmount.
  • gsap.context() and contextSafe wrappers for safe callbacks in React components, including Next.js SSR considerations.
  • Clear guidance for building scroll-based and interaction-driven animations inside React apps with minimal boilerplate.

Quick Start

Use useGSAP with a container ref to safely animate elements inside a React component.

Frequently Asked Questions about gsap-react

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

FAQPage Schema
How do I create GSAP animations in React that clean up on unmount?

To create unmount-safe GSAP animations in React, use the useGSAP hook with a scoped container ref. This pattern ensures automatic cleanup when the component unmounts, preventing memory leaks and animation conflicts.

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

Yes, GSAP works with Next.js SSR by using contextSafe wrappers and gsap.context(). These tools isolate animations, ensuring reliable wiring and safe execution during server-side rendering and client hydration.

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

The best way to scope GSAP selectors is using the useGSAP hook with a container ref. This confines animations to specific elements within that container, preventing unintended changes to the DOM.

Why do I need contextSafe wrappers for GSAP callbacks in React?

You need contextSafe wrappers to ensure GSAP callbacks execute safely within the React component lifecycle. They maintain the scoped context, preventing animation errors during state updates or component unmounting.

How do I build scroll-based GSAP animations in React without boilerplate?

Build scroll-based GSAP animations by configuring the useGSAP hook within a scoped container. This approach provides clear guidance and minimal boilerplate for creating interaction-driven animations in React apps.