react-code-dataset / next.js /test /development /app-dir /cache-components-dev-warmup /app /data-fetching.ts
Download next.js/test/development/app-dir/cache-components-dev-warmup/app/data-fetching.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 272 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/cache-components-dev-warmup/app/data-fetching.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/development/app-dir/cache-components-dev-warmup/app/data-fetching.ts
-
curl -L -o data-fetching.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/cache-components-dev-warmup/app/data-fetching.ts
272 Bytes
| export async function fetchCached(url: string) { | |
| const response = await fetch(url, { cache: 'force-cache' }) | |
| return response.text() | |
| } | |
| export async function getCachedData(_key: string) { | |
| 'use cache' | |
| await new Promise((r) => setTimeout(r)) | |
| return Math.random() | |
| } | |