mirror of
https://github.com/r-freeman/portfolio.git
synced 2024-11-22 23:15:41 +00:00
Removed redundant function
This commit is contained in:
parent
0524cbdaf4
commit
6b4d2b21fd
@ -1,4 +1,3 @@
|
|||||||
import {useEffect, useRef} from 'react'
|
|
||||||
import type {AppProps} from 'next/app'
|
import type {AppProps} from 'next/app'
|
||||||
import {Header} from '@/components/Header'
|
import {Header} from '@/components/Header'
|
||||||
import {Footer} from '@/components/Footer'
|
import {Footer} from '@/components/Footer'
|
||||||
@ -6,19 +5,7 @@ import {Footer} from '@/components/Footer'
|
|||||||
import '../styles/tailwind.css'
|
import '../styles/tailwind.css'
|
||||||
import 'focus-visible'
|
import 'focus-visible'
|
||||||
|
|
||||||
function usePrevious(value: string): string | null {
|
export default function App({Component, pageProps}: AppProps) {
|
||||||
let ref = useRef<string | null>(null)
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
ref.current = value
|
|
||||||
}, [value])
|
|
||||||
|
|
||||||
return ref.current
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function App({Component, pageProps, router}: AppProps) {
|
|
||||||
let previousPathname = usePrevious(router.pathname)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="fixed inset-0 flex justify-center sm:px-8">
|
<div className="fixed inset-0 flex justify-center sm:px-8">
|
||||||
@ -29,7 +16,7 @@ export default function App({Component, pageProps, router}: AppProps) {
|
|||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Header/>
|
<Header/>
|
||||||
<main>
|
<main>
|
||||||
<Component previousPathname={previousPathname} {...pageProps} />
|
<Component {...pageProps} />
|
||||||
</main>
|
</main>
|
||||||
<Footer/>
|
<Footer/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user