Download next.js/test/e2e/getserversideprops/app/pages/refresh.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 431 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/getserversideprops/app/pages/refresh.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/getserversideprops/app/pages/refresh.js
-
curl -L -o refresh.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/getserversideprops/app/pages/refresh.js
431 Bytes
| import { useEffect, useState } from 'react' | |
| const foo = (query) => query | |
| export const FOO = foo('query') | |
| const MyPage = () => { | |
| const [isMounted, setMounted] = useState(false) | |
| useEffect(() => { | |
| setMounted(true) | |
| }, []) | |
| if (isMounted) { | |
| return <p>client loaded</p> | |
| } | |
| return <p>server</p> | |
| } | |
| const getServerSideProps = async () => { | |
| return { props: {} } | |
| } | |
| export default MyPage | |
| export { getServerSideProps } | |