maisano / react-router-transition

painless transitions built for react-router, powered by react-motion
http://maisano.github.io/react-router-transition/
MIT License
2.59k stars 138 forks source link

Transition works on the first time, but Component goes missing on the second time. #111

Closed saulojoab closed 4 years ago

saulojoab commented 4 years ago

When I click a button to go to the next page, the transition works just fine. But when I click to go to another page, it transitions but when the transition is finished the page goes blank.

Here's how I'm using it:

ReactDOM.render(
    <Router>
        <AnimatedSwitch
            atEnter={fadeTransition.atEnter}
            atLeave={fadeTransition.atLeave}
            atActive={fadeTransition.atActive}
            mapStyles={fadeTransition.mapStyles}
            className="transitionContainer"
        >
            <Route path="/" exact={true} component={Login} />
            <Route path="/confirmation" component={Confirmation} />
            <Route path="/admin" exact={true} component={Admin} />
            <Route path="/home" component={Home} />
        </AnimatedSwitch>
    </Router>
, document.getElementById('root'));

It works just fine on the first transition, but the transitionContainer div goes missing after the second one: image This is what happens to the HTML code when the transition is finished: image As you can see, the transitionContainer div isn't there anymore.

I have no clue what's causing this. I don't think I did anything wrong, the page loads just fine but then goes missing when the transition ends. Any clues on how to fix it?

saulojoab commented 4 years ago

Apparently this is an issue with React Router, so I'm closing this.

saulojoab commented 4 years ago

Fixed it by not using useEffect() as async on any component, in case anyone wanna know.

useEffect(() => {

}, []);