Skip to content

Commit

Permalink
[Docs] Focus on useRouter (#14515)
Browse files Browse the repository at this point in the history
[ch4109]

Closes #14500

Our current docs for `next/router` use examples from both `useRouter` and `import Router from 'next/router'`, with this PR I'm unifying the API into `useRouter` (`withRouter` is still going to be mentioned multiple times as it is the HOC alternative) and no longer mentioning that you can import a global `Router` object from `next/router`, not sure if I should mention it at least once but that didn't seem to be required.

I also did some structural changes to the docs for `next/router`, now every method starts with a description, then the implementation and explanation of the parameters of the method, and then the usage example, because every method uses the same `Usage` title the hash for them would be something like `#usage`, `#usage-1`, `#usage-2`, e.t.c, so I'm not very happy with this but it looks good.

Feedback wanted 🙏
  • Loading branch information
lfades authored Jun 25, 2020
1 parent 3b12dbf commit c6dc34e
Show file tree
Hide file tree
Showing 4 changed files with 193 additions and 129 deletions.
2 changes: 1 addition & 1 deletion docs/advanced-features/custom-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ module.exports = {

> Note that `useFileSystemPublicRoutes` disables filename routes from SSR; client-side routing may still access those paths. When using this option, you should guard against navigation to routes you do not want programmatically.
> You may also wish to configure the client-side Router to disallow client-side redirects to filename routes; for that refer to [`Router.beforePopState`](/docs/api-reference/next/router.md#router.beforePopState).
> You may also wish to configure the client-side router to disallow client-side redirects to filename routes; for that refer to [`router.beforePopState`](/docs/api-reference/next/router.md#router.beforePopState).
Loading

0 comments on commit c6dc34e

Please sign in to comment.