Open History to see the last commit
1import React from 'react'
2import { useRouter } from 'next/router'
3import Link from 'next/link'
4β
5export const Header = () => {
6 const { pathname } = useRouter()
7β
8 return (
9 <header>
10 <Link href="/" className={pathname === '/' ? 'is-active' : ''}>
11 Home
12 </Link>
13 <Link
14 href="/client-only"
15 className={pathname === '/client-only' ? 'is-active' : ''}
16 >
17 Client-Only
18 </Link>
19 <style jsx>{`
20 header {
21 margin-bottom: 25px;
22 }
23 a {
24 font-size: 14px;
25 margin-right: 15px;
26 text-decoration: none;
27 }
28 .is-active {
29 text-decoration: underline;
30 }
31 `}</style>
32 </header>
33 )
34}