dutzi / dutzi.github.io

My blog's repo
https://dutzi.party
1 stars 0 forks source link

Animating Route Transitions Using React Router #31

Open dutzi opened 4 years ago

dutzi commented 4 years ago

Dear reader,

I'm using Github Issues as a platform for discussion (using Gitalk).

You can join the conversation either by commenting here, or in my blog 🌈

dutzi commented 4 years ago

Hey @davidkutas, not 100% sure I follow, but maybe you could do it using useRef?

Define a ref to some value, 0.

When clicking on an item, set the value to be the index of the item clicked.

Inside the transition handler (onLeave), read the ref's value and trigger the appropriate animation.

davidkutas commented 4 years ago

@dutzi Thank you for the answer; I'll try.

a2thab commented 3 years ago

This is so great thank you. However unfortunately i cant get it working with React Router switch. Either the enter or leave calls are bypassed. All working without the switch. I note you haven't used it in the example. Can you offer any insight?

dutzi commented 3 years ago

Hey @a2thab, thanks for bringing it up. I can think of one reason why this could happen, is there an environment where I can reproduce it?

a2thab commented 3 years ago

To be honest i'm not so keen to make it public at the moment. It's good to know that it should work. I'm sure i'll sort it out eventually. I'm new to React so it's bound to be a rookie mistake.Thanks again Eldad

On Sun, Oct 18, 2020 at 5:23 AM Eldad Bercovici notifications@github.com wrote:

Hey @a2thab https://github.com/a2thab, thanks for bringing it up, I can think of one reason why this could happen, is there an environment I can see it happen on?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dutzi/dutzi.github.io/issues/31#issuecomment-711060893, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARB445RT265HHJXPKLNQPADSLHOKFANCNFSM4L7PRYBA .

dutzi commented 3 years ago

No problem, I'll try setting up a similar environment in the coming days

a2thab commented 3 years ago

I’d really appreciate that. I’ll jump on if I work it out before..by some miracle of evolution :)

On 18 Oct 2020, at 9:50 pm, Eldad Bercovici notifications@github.com wrote:

 No problem, I'll try setting up a similar environment in the coming days

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.