Skip to content

Instantly share code, notes, and snippets.

View GusRuss89's full-sized avatar

Angus Russell GusRuss89

View GitHub Profile

Keybase proof

I hereby claim:

  • I am gusruss89 on github.
  • I am gusruss89 (https://keybase.io/gusruss89) on keybase.
  • I have a public key ASAcQJYShZAfM-0JTMWLW4L9_DT67xRY_f5DEGUKcZHZhQo

To claim this, I am signing this object:

import React, { useRef, useEffect, memo } from 'react'
import { useRouter } from 'next/router'
const ROUTES_TO_RETAIN = ['/dashboard', '/top', '/recent', 'my-posts']
const App = ({ Component, pageProps }) => {
const router = useRouter()
const retainedComponents = useRef({})
const isRetainableRoute = ROUTES_TO_RETAIN.includes(router.asPath)