From 7647643921f3fdf33f37b3208016148e43ee0e32 Mon Sep 17 00:00:00 2001 From: Serubin Date: Fri, 22 Mar 2024 01:48:06 -0400 Subject: [PATCH] Add custom 404 page that redirects to home --- pages/404.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 pages/404.tsx diff --git a/pages/404.tsx b/pages/404.tsx new file mode 100644 index 0000000..834890a --- /dev/null +++ b/pages/404.tsx @@ -0,0 +1,13 @@ +import type { NextPage } from 'next'; +import { useRouter } from 'next/navigation'; +import { useEffect } from 'react'; + +// This custom 404 page will just redirect to / +// This is fine for this site because there are only two pages +const NotFound: NextPage = (): JSX.Element => { + const { push } = useRouter(); + useEffect(() => push('/')); + + return <>; +}; +export default NotFound;