trungdq88 / react-router-page-transition

Highly customizable page transition component for your React Router
https://trungdq88.github.io/react-router-page-transition
MIT License
542 stars 53 forks source link

Any plans to support react router v4? #22

Closed trymbill closed 3 years ago

trymbill commented 7 years ago

Just set this up and started looking through the issues to figure out why it wasn't working and noticed a comment stating that React Router V4 isn't supported.

Just wondering if there are any plans to add support for V4?

austincondiff commented 7 years ago

Oh, that would have been helpful to know. I assumed this supported react router v4, implemented this and was wondering why I was getting errors. My mistake but support would be fantastic!

trungdq88 commented 7 years ago

Sorry for any inconvenience. I'll add a note about the unavailable support for react-router v4 on the front page. I'll take a look at react-router 4 and see what I can do.

trungdq88 commented 7 years ago

After a short investigate, I found out that callbacks are not supported on React Router 4, however the basic CSS transitions still works. You have to wrap your <Route> with <Switch>.

        <PageTransition>
          <Switch location={this.props.location}>
            <Route exact path="/" component={ListPage} />
            <Route path="/detail/:itemId" component={ItemDetailPage} />
          </Switch>
        </PageTransition>

React Router 4's philosophy of routing is quite different than it's previous version, therefore I have to see if I can still continue to support current behavior on React Router 4 or to propose a better rewrite.

rxaviers commented 6 years ago

It would be great if it's possible to decoupled the transitions logic from the React Router integration.

rxaviers commented 6 years ago

I just noticed this library has actually no dependency on React Router other than its name. Such integration only happens on the examples. Excellent.