gsap-react

Set up and clean up GSAP animations in React components with the useGSAP hook.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill simplifies GSAP animations in React applications, allowing for easy setup and clean-up.

Core Features & Use Cases

  • useGSAP() Hook: A React hook for setting up GSAP animations with automatic cleanup.
  • Scoped Animations: Utilizes DOM ref scope for animation selectors.
  • ContextSafe Callbacks: Safe event handling to prevent unwanted animations after component unmount.
  • SSR Handling: Ensures GSAP is used only on the client-side, avoiding SSR conflicts.
  • Use Case: Quick animation prototyping for UI enhancements in React or Next.js applications.

Quick Start

Use the 'gsap-react' skill to animate the 'box' and 'item' elements with the useGSAP() hook.

Frequently Asked Questions about gsap-react

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

FAQPage Schema
How do I set up GSAP animations in React without causing memory leaks?

GSAP animations in React can be set up safely using the useGSAP hook, which handles automatic animation cleanup when components unmount. This approach scopes animations to specific DOM refs and prevents memory leaks.

Why do my GSAP animations break or cause conflicts during Next.js server-side rendering?

GSAP animations conflict with server-side rendering because they require DOM access. This Skill ensures client-side execution only, avoiding SSR conflicts by safely handling GSAP initialization within the React component lifecycle.

Can I use GSAP with React refs to target specific elements for animation?

Yes, GSAP can target specific elements using React DOM refs. The useGSAP hook utilizes a ref scope for animation selectors, ensuring that animations only apply to the intended elements within your component structure.

What is the best way to handle GSAP event callbacks safely in a React component?

The best way to handle GSAP callbacks safely is using contextSafe callback handling. This prevents unwanted animations from firing after a component unmounts, ensuring clean event management within your React UI.

Does this GSAP React hook approach support rapid UI animation prototyping?

Yes, this GSAP React approach supports rapid UI animation prototyping. It provides a clean and maintainable developer experience for quickly adding and testing UI enhancements in React or Next.js applications.