dutzi / react-route-transition

A tiny and simple transition orchestrator for React
https://dutzi.github.io/react-route-transition
34 stars 2 forks source link

Support exit A while entering B? #2

Open sbtly opened 4 years ago

sbtly commented 4 years ago

Is there a way to do ‘exit A comp while entering B comp’ instead of ‘exit A comp before entering B comp’?

It seems that right now, it only supports showing one component at a time. It would be really useful if exiting component and entering component visible at the same time.

For example, framer-motion has ‘AnimatePresence’ component that does this.

dutzi commented 4 years ago

I wish! But when using react-router, as soon the url changes, the previous component unmounts and the new one takes its place. So no 🤷‍♂️.

sbtly commented 4 years ago

In that case, 'AnimatePresence' component from framer-motion can be used with react-router! It prevents component from unmount until transition is finished. https://codesandbox.io/embed/react-pose-route-transitions-with-reach-router-76mf0

I'm not pushing you or anything, I just hope this library also support this feature. It would be so awesome.

dutzi commented 4 years ago

Cool! I'll check it out.