gsap-react-router
Skill5 starsChanged 2 months agoMITView on GitHub
Build or review GSAP animation in React Router v7 and v8 projects in framework mode (SSR on or off), data mode, or declarative mode: page transitions, enter and exit motion across client-side navigation, animated show and hide of conditional content, and scroll-driven effects. Use whenever a React Router or Remix-style project needs any of these, even if GSAP is not named, and whenever an intro fails to replay on a param change, an outro is cut off by navigation, layout jank, interrupted animations, or cleanup matter. Covers useBlocker as the only hold on navigation, useNavigation and pending UI, loaders, Outlet and route reuse, Link viewTransition and useViewTransitionState, back and forward, ScrollRestoration, and choosing GSAP or View Transitions per effect. Not for Next.js (gsap-nextjs), TanStack Router (gsap-tanstack-router), React without a router (gsap-react), or isolated GSAP API questions.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- johnpolacek/animaxxing-skillsedited, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- johnpolacek/animaxxing-skills★ 2253% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository57 other files it gives its agents.
- adversarial-reviewSkill
- aesthetic-animaxxingSkill
- ai-search-optimizationSkill
- announceSkill
- audio-trackSkill
- blindspotSkill
- brave-wesSkill
- chrome-wesSkill
- clihubSkill
- dashclaw-governanceSkill
- deskclawSkill
- de-vibeSkill
- dispatch-blocksSkill
- epic-infographicsSkill
- fable-gptSkill
- frontend-verifySkill
- gsap-astroSkill
- gsap-coreSkill
- gsap-frameworksSkill
- gsap-nextjsSkill
- gsap-nuxtSkill
- gsap-performanceSkill
- gsap-pluginsSkill
- gsap-reactSkill
- gsap-scrolltriggerSkill
- gsap-sveltekitSkill
- gsap-tanstack-routerSkill
- gsap-timelineSkill
- gsap-utilsSkill
- gsap-vanillaSkill
- harness-healthSkill
- iphoneSkill
- landing-page-cro-expertSkill
- launchSkill
- launch-videoSkill
- logo-revealSkill
- marketingSkill
- marketing-studioSkill
- meditateSkill
- moleresearchSkill
- og-assetsSkill
- petstoreSkill
- phone-gotchasSkill
- phoneSkill
- preflightSkill
- product-demoSkill
- ship-itSkill
- shipSkill
- show-meSkill
- skillfindSkill
- social-clipSkill
- spec-probeSkill
- teamSkill
- tregSkill
- wes-voiceSkill
- wrapSkill
- xplainerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 7 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Every animated page or component runs through the same lifecycle:
- Distinctive: line 21
Read repository instructions and the current code.
- Very specific: line 25
Look at root.tsx or the root element, layouts with <Outlet>, navigation components, <ScrollRestoration>, global CSS, accessibility …
- Distinctive: line 26
Keep the project's package manager, language, file layout, styling, and component conventions.
- Very specific: line 28
Add GSAP, @gsap/react, or a plugin only when the requested motion needs it.
- Distinctive: line 40
Use GSAP when the effect needs:
- Distinctive: line 58
Before calling work done: Verification.
- Very specific: line 82
Keep outgoing routes mounted and visible through outro and end state.
- Very specific: line 83
Never block or outro a POP.
- Very specific: line 88
Keep native link behavior: modified clicks, target, reloadDocument, external URLs, prefetch, NavLink state, focus, scroll, and …
- Very specific: line 91
Prefer transforms and autoAlpha.
- Distinctive: line 92
Use timelines for sequences.
- Distinctive: line 93
Verify in a real browser when practical.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GSAP React Router
Every animated page or component runs through the same lifecycle:
mount → initial state → intro → settled → outro → end state → unmount
Mount and unmount belong to React. The five phases between them belong to your animation code and happen while the node exists. This skill covers getting those phases right when React Router decides when routes load, commit, reuse, and unmount: navigation timing, holding a navigation, route reuse, interruptions, and cleanup. The user's request and the existing design decide how things look.
React Router has no leave hook. A link click starts loading at once, and the outgoing route unmounts when the incoming one commits. useBlocker is the only way to hold a navigation, and a route matched again with new params keeps its element mounted. See Route lifetime.
Start with the project
- Read repository instructions and the current code.
- Confirm React Router 7 or later and its mode. Framework mode has
react-router.config.ts,routes.ts,root.tsx, andHydratedRouterinentry.client.tsx. Data mode hascreateBrowserRouterandRouterProvider. Declarative mode hasBrowserRouterand no loaders, nouseNavigation, and no blocker. A Remix 2 app uses the same hooks from@remix-run/react; say so and map the names. - Read the installed version from
node_modules/react-router/package.json. The package ships itsdocs/,CHANGELOG.md, and.d.tsfiles indist/; prefer them over memory. Version gates:useBlocker(6.19),viewTransitionanduseViewTransitionState(6.27),Link maskanduseTransitions(7.15), middleware (7.9 behindfuture.v8_middleware, always on in 8). Version 8 is ESM-only, needs React 19.2, and dropsreact-router-dom:RouterProviderandHydratedRoutercome fromreact-router/dom. - In framework mode check
ssrandprerenderinreact-router.config.ts. Server-rendered and prerendered pages paint HTML before hydration.ssr: falseships anindex.htmlholding only the root route and itsHydrateFallback, so route content renders after hydration and needs no pre-paint rule. Data and declarative mode without server rendering are the same. - Look at
root.tsxor the root element, layouts with<Outlet>, navigation components,<ScrollRestoration>, global CSS, accessibility conventions, tests, and any animation library already in use. - Keep the project's package manager, language, file layout, styling, and component conventions.
Add GSAP, @gsap/react, or a plugin only when the requested motion needs it. Do not replace an animation library the project already chose unless asked.
Pick GSAP or View Transitions per effect
React Router wraps a navigation in document.startViewTransition when the Link, Form, or navigate call sets viewTransition. Use that for:
- A shared element that morphs between two routes, named through
useViewTransitionStateor the NavLinkisTransitioningrender prop. - A whole-page crossfade or slide keyed by a class on the root while the transition runs.
- A swap that should not be a hard cut, including back and forward, which replay a recorded transition.
These need no lifecycle code and fall back to a plain update where the API is missing.
Use GSAP when the effect needs:
- An outro that finishes on the live outgoing page before the router loads and commits the next route.
- Interruption, reversal, or scrubbing mid-transition. A view transition is a fixed pair of snapshots.
- Sequenced timing across many targets, split text, or scroll-linked progress.
- A completion callback that gates navigation, focus, or unmount.
Mixing is fine: the browser morphs one image while GSAP animates the rest. Never give one element to both in the same transition. See Combining with View Transitions.
Follow the requested motion
The user's request decides effects, direction, timing, easing, and intensity. Map it onto the five phases without changing the look. For anything unspecified, keep the project's existing convention or pick a quiet default.
Read only what you need
- The blocker outro, transition-aware links, the lock, pending state, back and forward, the swap gap, scroll, focus, View Transitions: React Router navigation.
- Modes and their hooks, route reuse versus remount, layouts and
<Outlet>, SSR and SPA mode first paint, streaming, fetchers, modal routes: Route lifetime. - The five phases, GSAP setup, React lifecycle, show and hide, layout stability, scroll, text, plugins: Lifecycle implementation.
- Before calling work done: Verification.
The official GSAP skills (gsap-core, gsap-react, gsap-timeline, gsap-scrolltrigger, gsap-plugins, gsap-utils, gsap-performance) cover the GSAP API, and gsap-react covers useGSAP, scope, contextSafe, and cleanup on unmount. This skill covers how GSAP fits React Router.
Pieces to add, only as needed
- One client-only module that registers GSAP and plugins. In framework mode name it
*.client.tsso the server bundle never evaluates it, and import it for its side effect only, from the root route. Components importgsapanduseGSAPfrom the packages: a.clientmodule's exports areundefinedduring server rendering, and a route component that callsuseGSAPthrough it throws on the server. - A route transition boundary in the root route, or in the layout that wraps the changing region, with one stable route container around
<Outlet>. useBlockerin that boundary as the hold, when the outro must finish before navigation. One blocker per router.- A transition-aware Link that wraps
<Link>, plus a navigate helper, when there is no blocker (declarative mode) or the project prefers it. - A key on the outlet, or a
pathnamedependency, so a reused route runs its lifecycle again. - Refs or data attributes marking the elements a page animates.
- A controller per page or component that owns its five phases.
- Intro and outro timeline builders.
- A presence controller when conditional content must stay mounted through its outro.
Persistent header, nav, and footer live in the root route outside the container. A component owns its own lifecycle; the boundary owns page lifecycles.
Rules
- GSAP runs only in the browser. Framework mode evaluates route modules on the server, so keep GSAP calls inside
useGSAPor effects and registration in a.clientmodule. Scope selectors. Clean up every tween, trigger, split, and listener. - Lay out the final page with normal CSS first. One stable wrapper owns the geometry through every phase.
- Mount, then set initial values, then paint. Server HTML paints before hydration: hide intro targets only under a root attribute set by an inline script in the root
Layout, only during the initial phase, with a no-JavaScript path. - Animate to one settled state and clear temporary styles there.
- Keep outgoing routes mounted and visible through outro and end state. The router unmounts the old route when the new one commits, so hold the commit:
useBlockerandproceed()from the end callback, or prevent the Link default andnavigateafter the outro. - Never block or outro a
POP. Back and forward get initial state and intro only, after scroll restoration. - A navigation to the same route with new params reuses the element. Key the outlet on
location.pathname, or run the lifecycle again from apathnamedependency against DOM that already holds settled values. - Loaders run after
proceed(), so the end state waits for data. Prefetch on intent and cover the route container until the incoming targets are prepared. - A fetcher is not a navigation. Do not treat
fetcher.stateas a page transition. - One engine per element. A named view transition and a GSAP tween on the same node fight.
- Keep native link behavior: modified clicks,
target,reloadDocument, external URLs,prefetch,NavLinkstate, focus, scroll, and no-JavaScript readability. - Prepare incoming targets before revealing the swap. Never flash settled or stale content.
- Reduced motion reaches the same settled state and still fires every completion callback, including the one that calls
proceed(). - Prefer transforms and
autoAlpha. Setwill-changeonly while animating, then clear it. - Use timelines for sequences. Decide up front what happens on rapid clicks and interrupted animations.
- Verify in a real browser when practical. Use a production build for route, config, dependency, or release changes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

