Skip to content

Commit e8e53da

Browse files
committed
lesson-8
1 parent 558c7d4 commit e8e53da

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pages/404.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
import Link from 'next/link'
2+
import { useEffect } from 'react'
3+
import { useRouter } from 'next/router'
24

35
const NotFound = () => {
6+
const router = useRouter()
7+
8+
useEffect(() => {
9+
setTimeout(() => {
10+
// router.go(-1)
11+
// router.go(1)
12+
router.push('/')
13+
}, 3000)
14+
}, [])
15+
416
return (
517
<div className="not-found">
618
<h1>Ooops...</h1>
719
<h2>That page cannot be found :(</h2>
8-
<p>Go back to the <Link href="/"><a>Homepage</a></Link></p>
20+
<p>Going back to the <Link href="/"><a>Homepage</a></Link> is 3 seconds...</p>
921
</div>
1022
);
1123
}

0 commit comments

Comments
 (0)