-
Notifications
You must be signed in to change notification settings - Fork 26.1k
/
index.js
41 lines (36 loc) · 905 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import Link from 'next/link'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
export default function Page(props) {
const router = useRouter()
const [mounted, setMounted] = useState(false)
useEffect(() => {
setMounted(true)
}, [])
return (
<>
<p id="page">index page</p>
<p id="props">{JSON.stringify(props)}</p>
<p id="router">
{JSON.stringify(
mounted
? {
basePath: router.basePath,
pathname: router.pathname,
asPath: router.asPath,
query: router.query,
}
: {}
)}
</p>
<Link href="/another">
<a id="to-another">to /another</a>
</Link>
<br />
<Link href="/dynamic/first">
<a id="to-dynamic">to /dynamic/first</a>
</Link>
<br />
</>
)
}