Skip to content

Instantly share code, notes, and snippets.

@Brlaney
Created July 29, 2021 02:02
Show Gist options
  • Save Brlaney/bc01f90b493485a19d125f9087d2d930 to your computer and use it in GitHub Desktop.
Save Brlaney/bc01f90b493485a19d125f9087d2d930 to your computer and use it in GitHub Desktop.
Using framer motion with next.js
import * as React from 'react'
import type { AppProps /*, AppContext */ } from 'next/app'
import Head from 'next/head'
import { useRouter } from 'next/router'
import { AnimatePresence } from 'framer-motion'
import theme from '@/lib/theme/theme'
import '@/styles/globals.scss'
export default function MyApp (props: AppProps) {
const { Component, pageProps } = props
const router = useRouter()
return (
<Head>
<meta charSet='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1' />
<meta name='keywords' content='keywords' />
<meta name='description' content='description' />
<title>title</title>
</Head>
<AnimatePresence>
<Component {...pageProps} key={router.route} />
</AnimatePresence>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment