Created
March 23, 2021 00:16
-
-
Save paulphys/c188394103ee8209247644997b3042e4 to your computer and use it in GitHub Desktop.
Next.js Typescript 404 Redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect } from "react" | |
import { useRouter } from "next/router" | |
export default function Custom404() { | |
const router = useRouter() | |
useEffect(() => { | |
router.replace("/") | |
}) | |
return null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment