Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Wording and grammar corrections #6325

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions packages/docs/src/routes/docs/(qwikcity)/api/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,7 @@ The above code would generate:

## `useNavigate()`

The `useNavigate()` function allows to programmatically navigate to the next page without involving a user click or causing a full-page reload. This is the API used by the `<Link>` component internally to support SPA navigation.

This function returns a `nav()` function that can be used to "push" to a new path.

Also, `useNavigate` can be used to SPA refresh the current page, by calling the `nav()` function without arguments.
The `useNavigate()` hook returns a function that programmatically navigates to the next page without requiring a user click or causing a full-page reload. This function can be called with a string argument to "push" a new path, or without arguments to cause an SPA refresh of the page. This is the API used by the `<Link>` component internally to support SPA navigation.

```tsx {12,21} /useNavigate/
import { component$ } from '@builder.io/qwik';
Expand Down Expand Up @@ -213,14 +209,13 @@ export default component$(() => {
});
```

This component will have a button then when clicked, Qwik City will navigate to `/dashboard` without causing a page to reload.
This component has a button that when clicked, will navigate to `/dashboard` without causing a page reload.

> Notice that for SEO, and accessibility it's better to use the `<Link>` component instead of `useNavigate()` programmatically to navigate to a new page after some user interaction.

### Going back

In Qwik, you can programmatically navigate back to the previous page using the useNavigate and useLocation hooks.

To programmatically navigate back to the previous page, use the useNavigate and useLocation hooks.

```tsx
import { component$ } from '@builder.io/qwik';
Expand Down
Loading