react-code-dataset / next.js /test /development /app-dir /use-cache-errors /app /module-with-use-cache.ts
Download next.js/test/development/app-dir/use-cache-errors/app/module-with-use-cache.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 719 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/use-cache-errors/app/module-with-use-cache.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/development/app-dir/use-cache-errors/app/module-with-use-cache.ts
-
curl -L -o module-with-use-cache.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/app-dir/use-cache-errors/app/module-with-use-cache.ts
719 Bytes
| 'use cache' | |
| // This file simulates adding a "use cache" directive to a client module that's | |
| // mistaken as a server module. It does not have itself a "use client" | |
| // directive, but is imported by a client module with a "use client" directive, | |
| // while also importing another client module with a "use client" directive. | |
| // Adding the "use cache" directive here, effectively forces the module to be a | |
| // server module, which then results in an error when trying to call the client | |
| // function. | |
| import { useStuff } from './client-module' | |
| export async function useCachedStuff() { | |
| // Intentional misusage (using hooks in async functions). | |
| // eslint-disable-next-line react-hooks/rules-of-hooks | |
| return useStuff() | |
| } | |