react-code-dataset / next.js /test /development /pages-dir /client-navigation /fixture /pages /nav /as-path-query.js
Download next.js/test/development/pages-dir/client-navigation/fixture/pages/nav/as-path-query.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 765 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/pages-dir/client-navigation/fixture/pages/nav/as-path-query.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/development/pages-dir/client-navigation/fixture/pages/nav/as-path-query.js
-
curl -L -o as-path-query.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/development/pages-dir/client-navigation/fixture/pages/nav/as-path-query.js
765 Bytes
| import Link from 'next/link' | |
| import { withRouter } from 'next/router' | |
| export default withRouter(({ router: { asPath, query } }) => { | |
| return ( | |
| <div | |
| id={asPath | |
| .replace('/', '') | |
| .replace('/', '-') | |
| .replace('?', '-') | |
| .replace('=', '-')} | |
| > | |
| <div id="router-query">{JSON.stringify(query)}</div> | |
| <div> | |
| <Link | |
| href="/nav/as-path-query?something=hello" | |
| as="/something/hello?something=hello" | |
| id="hello" | |
| > | |
| hello | |
| </Link> | |
| </div> | |
| <div> | |
| <Link | |
| href="/nav/as-path-query?something=else" | |
| as="/something/hello?something=else" | |
| id="hello2" | |
| > | |
| hello | |
| </Link> | |
| </div> | |
| </div> | |
| ) | |
| }) | |