pmndrs / pmndrs/react-spring

Animations and persistence of components on route changes

Open
#1,628 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: request
Dominant language
TypeScript
Stars
29.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

🚀 Feature Proposal

The ability to animate (and persist) components during route changes.

Motivation

Currently it's not possible (or difficult) to animate components during a route change, but I think it's a very relevant use case. This would help making smooth animated transitions of specific components between pages.

Framer Motion currently has something similar implemented with AnimateSharedLayout. This is a wrapper, which allows you to give components on different pages the same ID, which signifies that this is the same component and that it will animate any differences between the first component (found on the original route) and the re-rendered component (on the new route).

Example

For example, assume you want to animate the transition from a grid with many products to a page containing a single product. When a user clicks on one product of the grid, you want to take that image, and scale it to large size, as if it's being zoomed in/focused on.

To achieve this the image component needs to persist during the route change, or at least react-spring needs to be told what the equivalent component is on the new route. Then the two components may be compared and any differences in properties animated.

Demo

A practical demo example how this would look like can be found here (click the Do It button). There's also a related tutorial that explains how this effect works with Framer Motion.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the issue's proposed route-change animation behavior and the linked Framer Motion example and tutorial. The payload names no repository files, tests, or entry points, so the implementation location and a concrete definition of done still need to be established.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.