gsap-react

Implement GSAP animations in React with useGSAP hook and cleanup.

1|Updated Feb 8, 2026
One-click install
npx skills add https://github.com/0monish/portfolio-vivek-kamani --skill gsap-react-0monish
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gsap-react
Source: https://github.com/0monish/portfolio-vivek-kamani/tree/main/.agents/skills/gsap-react
Command: npx skills add https://github.com/0monish/portfolio-vivek-kamani --skill gsap-react-0monish

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill empowers React developers to implement GSAP animations with proper cleanup, reducing memory leaks and SSR pitfalls in React-based apps like Next.js.

Core Features & Use Cases

  • Prefer the useGSAP() hook for safe, scoped animations in React.
  • Automatic cleanup on unmount and contextSafe for callbacks.
  • Supports gsap.context() for scope-based targeting in client-side rendering.

Quick Start

Install GSAP and @gsap/react, then wrap your component with the useGSAP() hook to animate elements within a scoped container.

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?

Use the useGSAP() hook from @gsap/react to implement GSAP animations with automatic cleanup on unmount, preventing memory leaks in your React components.

What is the best way to scope GSAP animations to a specific container in Next.js?

The best way to scope GSAP animations is using gsap.context() within the useGSAP() hook, isolating target selectors to a specific container in your Next.js client-side rendering.

Does GSAP work with server-side rendering in Next.js, or do I need client-side initialization?

GSAP requires client-side initialization to avoid SSR pitfalls; you must adhere to client-side rendering rules and safely initialize animations on the client using useGSAP().

How do I safely trigger GSAP animations from event callbacks in React?

Wrap your animation logic using the contextSafe feature provided by the useGSAP() hook to safely trigger GSAP animations from event callbacks while maintaining proper scope.

Why do my GSAP animations break or cause errors when navigating between routes in React?

Animations break without proper cleanup, but useGSAP() handles automatic cleanup on component unmount, ensuring GSAP animations are safely removed during React route changes.

What dependencies do I need to install to animate React components with GSAP safely?

Install the gsap package and the @gsap/react package to use the useGSAP() hook, which provides the necessary tools for safe, scoped animations in React.