Skip to content

How to animate route transitions in app directory? #42658

Answered by leerob
tomdohnal asked this question in Help
Discussion options

You must be logged in to vote

Hey everyone, I wanted to share one solution that might be relevant for you all. Here was my use case:

  • I needed to animate between different routes, from / to an individual product page
  • The URL should update when changing routes, and both clicking back in the navbar and the browser back button need to work
  • Reloading the page on the product detail page /p/[slug] needs to correctly start on the detail state (no animation)

I can definitely empathize with this being confusing, and apologize we haven't done enough to create examples or show how this could be possible. For example, trying to animate across routes using framer-motion (now motion) using the default page files in the App Router …

Replies: 36 comments 44 replies

Comment options

You must be logged in to vote
1 reply
@kavyantic
Comment options

Comment options

You must be logged in to vote
3 replies
@dvartic
Comment options

@Talent30
Comment options

@isomorpheric
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@kerns
Comment options

@NickWoodward
Comment options

@musamaraslinewcode
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@og2t
Comment options

@elbasel
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@yhemme
Comment options

@kblauhut
Comment options

@andershagbard
Comment options

@coreydunkin
Comment options

@ericdjavid
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@venkat5105
Comment options

@whatisjery
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@ancashoria
Comment options

@NickWoodward
Comment options

@kavyantic
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
11 replies
@leerob
Comment options

@rijk
Comment options

@ynamite
Comment options

@ismamz
Comment options

@ynamite
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@rijk
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@ST4LTH
Comment options

@gerardmarquinarubio
Comment options

@hyunjunian
Comment options

Answer selected by leerob
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet