From f357cd97fb1c4d9afac3cef7fb2370182f8c0fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Un=20=C3=89picier?= Date: Tue, 3 Sep 2024 19:08:03 +0200 Subject: [PATCH] :sparkles: Added automatic redirect to root url on 404 --- app/not-found.jsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 app/not-found.jsx diff --git a/app/not-found.jsx b/app/not-found.jsx new file mode 100644 index 0000000..44c90b3 --- /dev/null +++ b/app/not-found.jsx @@ -0,0 +1,16 @@ +'use client'; + +import { useEffect } from 'react'; +import { useRouter } from 'next/navigation'; + +const Custom404 = () => { + const router = useRouter(); + + useEffect(() => { + router.replace('/'); + }); + + return <>; +}; + +export default Custom404;