https://github.com/inside/router-query
https://github.com/inside/router-query
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/inside/router-query
- Owner: inside
- Created: 2023-02-13T14:56:35.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-13T15:03:15.000Z (over 3 years ago)
- Last Synced: 2025-02-01T20:25:37.208Z (over 1 year ago)
- Language: TypeScript
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Install with `npm install --legacy-peer-deps`
This repo demonstrates:
1. how a custom server, with a page **without** getInitialProps, with next-routes **incorrectly** populate `router.query`
1. From the index page, click on `Go to "a"`
1. The console logs: `from A, router.query : {slug: 'hello-world'}`, it works because of client side navigation
1. Refresh the page
1. The console logs: `from A, router.query : {}`, the query shouldn't be empty
1. how a custom server, with a page implemeting getInitialProps, with next-routes correctly populate `router.query`
1. From the index page, click on `Go to "b"`
1. The console logs:
```
from getInitialProps, ctx.query {slug: 'hello-world'}`
from B, router.query : {slug: 'hello-world'}
```
1. Refresh the page
1. The console logs: `from B, router.query : {slug: 'hello-world'}`, the query is correctly populated