Skip to content

Commit

Permalink
docs: Update API Reference index.mdx verbiage and phrasing (#6192)
Browse files Browse the repository at this point in the history
Co-authored-by: PatrickJS <github@patrickjs.com>
  • Loading branch information
Jemsco and PatrickJS committed Apr 30, 2024
1 parent ac47241 commit b0389cf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/docs/src/routes/docs/(qwikcity)/api/index.mdx
@@ -1,5 +1,5 @@
---
title: API reference | Qwik City
title: API Reference | Qwik City
description: Qwik City API reference.
contributors:
- manucorporat
Expand Down Expand Up @@ -115,7 +115,7 @@ export const RouterHead = component$(() => {

Use the [`useLocation()`](/docs/(qwikcity)/api/index.mdx#uselocation) function to retrieve a `RouteLocation` object for the current location.

`useLocation()` allows developers to know the current URL, params as well as if the app is currently navigating, which is useful for showing a loading indicator.
The `useLocation()` function provides the current URL and params. It also determines if the app is currently navigating, which is useful for showing a loading indicator.

```tsx
export interface RouteLocation {
Expand Down Expand Up @@ -219,7 +219,7 @@ This component will have a button then when clicked, Qwik City will navigate to
## `routeLoader$()`

The `routeLoader$()` function is used to declare a new Server Loader in the given page/middleware or layout. Qwik City will execute all the declared loaders for the given route match. Qwik Components can later reference the loaders, by importing them and calling the returned custom hook function in order to retrieve the data.
The `routeLoader$()` function is used to declare a new Server Loader in the given page/middleware or layout. Qwik City will execute all the declared loaders for the given route match. Qwik Components can later reference the loaders by importing them and calling the returned custom hook function in order to retrieve the data.

```tsx
import { component$ } from '@builder.io/qwik';
Expand Down Expand Up @@ -249,7 +249,7 @@ Please refer to the [Server Actions](/docs/(qwikcity)/action/index.mdx) section

The `QwikCityProvider` component initializes Qwik City in the existing document, providing the necessary context for Qwik City to work, such as [`useContent()`](/docs/(qwikcity)/api/index.mdx#usecontent) and `useLocation()`.

This component is usually located at the very root of your application, in most of the starters you will find it in the `src/root.tsx` file:
This component is usually located at the very root of your application. In most of the starters, you will find it in the `src/root.tsx` file:

```tsx title="src/root.tsx"
export default component$(() => {
Expand All @@ -276,7 +276,7 @@ export default component$(() => {
});
```

> `QwikCityProvider` does not render any DOM element, not even the matched route, it merely initializes Qwik City core logic, because of this reason, it should not be used more than once in the same app.
> `QwikCityProvider` does not render any DOM element, not even the matched route. It merely initializes Qwik City core logic so it should not be used more than once in the same app.

## `<QwikCityMockProvider>`
Expand Down Expand Up @@ -342,15 +342,15 @@ test('should render the button and navigate', async () => {

## `<RouterOutlet>`

The `RouterOutlet` component is responsible for rendering the matched route at a given moment, it uses internally the [`useContent()`](/docs/(qwikcity)/api/index.mdx#usecontent) to render the current page, as well as all the nested layouts.
The `RouterOutlet` component is responsible for rendering the matched route at a given moment, it internally uses the [`useContent()`](/docs/(qwikcity)/api/index.mdx#usecontent) to render the current page, as well as all of the nested layouts.

This component is usually located as a child of `<body>`, in most of the starters you will find it in the `src/root.tsx` file (refer to the example in `QwikCityProvider`).

## `<Form>`

The `Form` component is a wrapper around the native `<form>` element, and it's designed to work side by side with [Server Actions](/docs/(qwikcity)/action/index.mdx#using-actions-with-form).

Since this component uses the native `<form>` element, it will work with any browser with and without JavaScript enabled, in addition, it enhances the native `<form>` element by capturing the `submit` event and preventing the default behavior, so it will behave like an SPA (Single Page Application) instead of a full page reload.
Since this component uses the native `<form>` element, it will work with any browser with and without JavaScript enabled. In addition, it enhances the native `<form>` element by capturing the `submit` event and preventing the default behavior, so it will behave like an SPA (Single Page Application) instead of a full page reload.

```tsx title="src/routes/login/index.tsx"
import { component$ } from '@builder.io/qwik';
Expand Down

0 comments on commit b0389cf

Please sign in to comment.