Download next.js/test/e2e/app-dir/app-static/pages/unstable-cache-node.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 421 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/app-static/pages/unstable-cache-node.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/app-dir/app-static/pages/unstable-cache-node.js
-
curl -L -o unstable-cache-node.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/app-dir/app-static/pages/unstable-cache-node.js
421 Bytes
| import { unstable_cache } from 'next/cache' | |
| export async function getServerSideProps() { | |
| const data = await unstable_cache(async () => { | |
| return { | |
| random: Math.random(), | |
| } | |
| })() | |
| return { | |
| props: { | |
| now: Date.now(), | |
| data, | |
| }, | |
| } | |
| } | |
| export default function Page(props) { | |
| return ( | |
| <> | |
| <p>/unstable-cache-node</p> | |
| <p id="props">{JSON.stringify(props)}</p> | |
| </> | |
| ) | |
| } | |