Download react-query/examples/react/nextjs/src/components/Header.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 728 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/examples/react/nextjs/src/components/Header.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/examples/react/nextjs/src/components/Header.tsx
-
curl -L -o Header.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/examples/react/nextjs/src/components/Header.tsx
728 Bytes
| import React from 'react' | |
| import { useRouter } from 'next/router' | |
| import Link from 'next/link' | |
| export const Header = () => { | |
| const { pathname } = useRouter() | |
| return ( | |
| <header> | |
| <Link href="/" className={pathname === '/' ? 'is-active' : ''}> | |
| Home | |
| </Link> | |
| <Link | |
| href="/client-only" | |
| className={pathname === '/client-only' ? 'is-active' : ''} | |
| > | |
| Client-Only | |
| </Link> | |
| <style jsx>{` | |
| header { | |
| margin-bottom: 25px; | |
| } | |
| a { | |
| font-size: 14px; | |
| margin-right: 15px; | |
| text-decoration: none; | |
| } | |
| .is-active { | |
| text-decoration: underline; | |
| } | |
| `}</style> | |
| </header> | |
| ) | |
| } | |