aholachek / react-flip-toolkit-router-example

Meaningful transitions with react-router-v4 and react-flip-toolkit
https://react-flip-toolkit.surge.sh/
105 stars 18 forks source link

Next.js example? #4

Open loganpowell opened 5 years ago

loganpowell commented 5 years ago

Can I just say that this is the coolest animation library I've ever seen.

I'm trying to integrate this with Next.js and having a hard time mapping the react-router App.js file with the _app.js used by Next.js

Any chance you could make a next.js example?

🙏

talentlessguy commented 3 years ago

basic transitions should work with this:

import React, { Fragment, useEffect } from 'react'
import { AppProps } from 'next/app'
import { Flipper, Flipped } from 'react-flip-toolkit'

const CustomApp = ({ Component, pageProps, router }: AppProps) => {

  return (
    <Fragment>
      <Flipper flipKey={router.asPath}>
        <Flipped flipId="square">
          <div>
            <Component {...pageProps} />
          </div>
        </Flipped>
      </Flipper>
    </Fragment>
  )
}

export default CustomApp