-
Notifications
You must be signed in to change notification settings - Fork 26.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update examples/active-class-name (#34205)
## Description According to `Next.js` useRouter documentation: - `asPath`: The path (including the query) shown in the browser without the configured basePath or locale. - `pathname`: Current route. That is the path of the page in /pages, the configured basePath or locale is not included. `asPath` should not be used as the props of components. There are many cases that `asPath` not working as expected. For example: - `asPath` is different on server-side and client-side. - `asPath` can contains `id` and `query`. ## Suggestion - Warning the use of `asPath` can lead to the conflict of client and server-side. - Update `useRouter` document. ## Bug - [x] Related issues linked using `fixes #number` Fixes: #34144 Fixes: #34016 Fixes: #34197
- Loading branch information
Showing
4 changed files
with
59 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
async rewrites() { | ||
return [ | ||
{ | ||
source: '/blog', | ||
destination: '/news', | ||
}, | ||
] | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Nav from '../components/Nav' | ||
|
||
const News = () => ( | ||
<> | ||
<Nav /> | ||
<p>Hello, I'm the news page</p> | ||
</> | ||
) | ||
|
||
export default News |