react-route-transition icon indicating copy to clipboard operation
react-route-transition copied to clipboard

Support exit A while entering B?

Open sbtly opened this issue 5 years ago • 3 comments

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.

sbtly avatar Jul 17 '20 16:07 sbtly

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 🤷‍♂️.

dutzi avatar Jul 17 '20 18:07 dutzi

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.

sbtly avatar Jul 18 '20 08:07 sbtly

Cool! I'll check it out.

dutzi avatar Jul 18 '20 13:07 dutzi