Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

index.js

33 lines739 Bytes

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="/">
11 <a className={pathname === '/' ? 'is-active' : ''}>Home</a>
12 </Link>
13 <Link href="/client-only">
14 <a className={pathname === '/client-only' ? 'is-active' : ''}>
15 Client-Only
16 </a>
17 </Link>
18 <style jsx>{`
19 header {
20 margin-bottom: 25px;
21 }
22 a {
23 font-size: 14px;
24 margin-right: 15px;
25 text-decoration: none;
26 }
27 .is-active {
28 text-decoration: underline;
29 }
30 `}</style>
31 </header>
32 )