What problem does it solve?
React developers often need to animate UI elements without leaking animations or causing SSR issues. This skill provides a safe, scoped approach to GSAP animations in React, with automatic cleanup and clean integration with Next.js or other React frameworks.
Core Features & Use Cases
- useGSAP: Use GSAP's React integration to set up animations with automatic cleanup on unmount.
- Scoped targets: Attach a ref as the scope to ensure selectors only affect the component.
- Context-safe callbacks: Use contextSafe to wrap callbacks created inside event handlers so they clean up properly.
- SSR-friendly: Guidance to run animations on the client-side to avoid SSR pitfalls; suitable for Next.js or CRA apps.
- Use Cases: Animate on mount, hover interactions, orchestrate multiple elements with timelines within a component.
Quick Start
Start by creating a container ref and calling useGSAP in your component to animate elements within that container.