Download next.js/test/e2e/getserversideprops/app/pages/another/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 571 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/getserversideprops/app/pages/another/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/getserversideprops/app/pages/another/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/getserversideprops/app/pages/another/index.js
571 Bytes
| import Link from 'next/link' | |
| import path from 'path' | |
| import fs from 'fs' | |
| export async function getServerSideProps() { | |
| const text = fs | |
| .readFileSync(path.join(process.cwd(), 'world.txt'), 'utf8') | |
| .trim() | |
| return { | |
| props: { | |
| world: text, | |
| time: new Date().getTime(), | |
| }, | |
| } | |
| } | |
| export default ({ world, time }) => ( | |
| <> | |
| <p>hello {world}</p> | |
| <span id="anotherTime">time: {time}</span> | |
| <Link href="/" id="home"> | |
| to home | |
| </Link> | |
| <br /> | |
| <Link href="/something" id="something"> | |
| to something | |
| </Link> | |
| </> | |
| ) | |