forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.js
32 lines (29 loc) · 886 Bytes
/
page.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
import Link from 'next/link'
import { useSelector } from 'react-redux'
import Counter from './counter'
import Clock from './clock'
function Page({ linkTo, NavigateTo, title }) {
const placeholderData = useSelector((state) => state.placeholderData)
const error = useSelector((state) => state.error)
const light = useSelector((state) => state.light)
const lastUpdate = useSelector((state) => state.lastUpdate)
return (
<div>
<h1>{title}</h1>
<Clock lastUpdate={lastUpdate} light={light} />
<Counter />
<nav>
<Link href={linkTo}>
<a>Navigate: {NavigateTo}</a>
</Link>
</nav>
{placeholderData && (
<pre>
<code>{JSON.stringify(placeholderData, null, 2)}</code>
</pre>
)}
{error && <p style={{ color: 'red' }}>Error: {error.message}</p>}
</div>
)
}
export default Page