Download next.js/test/integration/app-tree/pages/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 357 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/integration/app-tree/pages/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/integration/app-tree/pages/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/integration/app-tree/pages/index.js
357 Bytes
| import { useContext } from 'react' | |
| import { DummyContext } from './_app' | |
| import { useRouter } from 'next/router' | |
| const Page = () => { | |
| const { pathname } = useRouter() | |
| const ctx = useContext(DummyContext) | |
| if (ctx == null) throw new Error('context consumes failed') | |
| return ( | |
| <> | |
| <h3>page: {pathname}</h3> | |
| </> | |
| ) | |
| } | |
| export default Page | |