diff options
Diffstat (limited to 'projects/96/src/app/not-found.js')
| -rw-r--r-- | projects/96/src/app/not-found.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/projects/96/src/app/not-found.js b/projects/96/src/app/not-found.js new file mode 100644 index 0000000..7298535 --- /dev/null +++ b/projects/96/src/app/not-found.js @@ -0,0 +1,31 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { useRouter } from "next/navigation"; + +export default () => { + const router = useRouter(); + + const [seconds, setSeconds] = useState(5); + + useEffect(() => { + const interval = setInterval(() => { + setSeconds((prev) => prev - 1); + }, 1000); + + if (seconds === 0) { + router.push("/"); + } + + return () => clearInterval(interval); + }, [seconds]); + + return ( + <div className="min-h-screen flex flex-col justify-center items-center space-y-4"> + <h2 className="text-3xl font-bold">404 - Page Not Found</h2> + <p> + Redirecting to <a href="/">Home</a> in {seconds} seconds... + </p> + </div> + ); +}; |
