a fun bot for the hc slack
1import { useNavigate } from "react-router-dom";
2import { useEffect, useState } from "react";
3
4export function NotFound() {
5 const navigate = useNavigate();
6 const [countdown, setCountdown] = useState(5);
7
8 useEffect(() => {
9 const timer = setInterval(() => {
10 setCountdown((prev) => {
11 if (prev <= 1) {
12 clearInterval(timer);
13 navigate("/");
14 return 0;
15 }
16 return prev - 1;
17 });
18 }, 1000);
19
20 return () => clearInterval(timer);
21 }, [navigate]);
22
23 return (
24 <div className="container">
25 <h1 className="title">404 - Page Not Found</h1>
26 <div className="no-takes-message">
27 <p>Redirecting to home page in {countdown} seconds...</p>
28 </div>
29 </div>
30 );
31}
32
33export default NotFound;