Download next.js/test/e2e/getserversideprops/app/pages/_app.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 586 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/getserversideprops/app/pages/_app.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/getserversideprops/app/pages/_app.js
-
curl -L -o _app.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/getserversideprops/app/pages/_app.js
586 Bytes
| import App from 'next/app' | |
| class MyApp extends App { | |
| static async getInitialProps(ctx) { | |
| const { req, query, pathname, asPath } = ctx.ctx | |
| let pageProps = {} | |
| if (ctx.Component.getInitialProps) { | |
| pageProps = await ctx.Component.getInitialProps(ctx.ctx) | |
| } | |
| return { | |
| appProps: { | |
| url: (req || {}).url, | |
| query, | |
| pathname, | |
| asPath, | |
| }, | |
| pageProps, | |
| } | |
| } | |
| render() { | |
| const { Component, pageProps, appProps } = this.props | |
| return <Component {...pageProps} appProps={appProps} /> | |
| } | |
| } | |
| export default MyApp | |