Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andriawan committed Aug 17, 2024
1 parent d7bd592 commit ead384b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/content/reference/react-dom/preload.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ canary: true

<Canary>

The `preload` function is currently only available in React's Canary and experimental channels. Learn more about [React's release channels here](/community/versioning-policy#all-release-channels).
Fungsi `preload` saat ini hanya tersedia di kanal Canary dan eksperimental React. Pelajari lebih lanjut tentang [kanal rilis React di sini](/community/versioning-policy#all-release-channels).

</Canary>

<Note>

[React-based frameworks](/learn/start-a-new-react-project) frequently handle resource loading for you, so you might not have to call this API yourself. Consult your framework's documentation for details.
[Framework berbasis React](/learn/start-a-new-react-project) sering kali menangani pemuatan sumber daya untuk Anda, jadi Anda mungkin tidak perlu memanggil API ini sendiri. Lihat dokumentasi framework Anda untuk detailnya.

</Note>

<Intro>

`preload` lets you eagerly fetch a resource such as a stylesheet, font, or external script that you expect to use.
`preload` memungkinkan Anda mengambil sumber daya seperti *stylesheet*, *font*, atau skrip eksternal yang ingin Anda gunakan.

```js
preload("https://example.com/font.woff2", {as: "font"});
Expand All @@ -29,11 +29,11 @@ preload("https://example.com/font.woff2", {as: "font"});

---

## Reference {/*reference*/}
## Referensi {/*reference*/}

### `preload(href, options)` {/*preload*/}

To preload a resource, call the `preload` function from `react-dom`.
Untuk memuat sumber daya, panggil fungsi `preload` dari `react-dom`.

```js
import { preload } from 'react-dom';
Expand All @@ -45,16 +45,16 @@ function AppRoot() {

```

[See more examples below.](#usage)
[Lihat contoh lainnya di bawah ini.](#usage)

The `preload` function provides the browser with a hint that it should start downloading the given resource, which can save time.
Fungsi `preload` memberikan petunjuk kepada browser untuk mulai mengunduh sumber daya yang diberikan, yang dapat menghemat waktu.

#### Parameters {/*parameters*/}
#### Parameter {/*parameters*/}

* `href`: a string. The URL of the resource you want to download.
* `options`: an object. It contains the following properties:
* `as`: a required string. The type of resource. Its [possible values](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#as) are `audio`, `document`, `embed`, `fetch`, `font`, `image`, `object`, `script`, `style`, `track`, `video`, `worker`.
* `crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`. It is required when `as` is set to `"fetch"`.
* `href`: sebuah string. URL sumber daya yang ingin Anda unduh.
* `options`: sebuah objek. Ini berisi properti-properti berikut:
* `as`: string yang diperlukan. Jenis sumber daya. Nilai [yang mungkin] (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#as) adalah `audio`, `document`, `embed`, `fetch`, `font`, `image`, `object`, `script`, `style`, `track`, `video`, `worker`.
* `crossOrigin`: sebuah string. [Kebijakan CORS] (https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) yang akan digunakan. Nilai yang mungkin adalah `anonymous` dan `use-credentials`. Ini diperlukan ketika `as` disetel ke `"fetch"`.
* `referrerPolicy`: a string. The [Referrer header](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#referrerpolicy) to send when fetching. Its possible values are `no-referrer-when-downgrade` (the default), `no-referrer`, `origin`, `origin-when-cross-origin`, and `unsafe-url`.
* `integrity`: a string. A cryptographic hash of the resource, to [verify its authenticity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
* `type`: a string. The MIME type of the resource.
Expand Down

0 comments on commit ead384b

Please sign in to comment.