Skip to content

Commit 22408a1

Browse files
committed
docs: translate preinit
1 parent 8ace8e5 commit 22408a1

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

src/content/reference/react-dom/preinit.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ canary: true
55

66
<Canary>
77

8-
The `preinit` 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).
8+
Fungsi `preinit` 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).
99

1010
</Canary>
1111

1212
<Note>
1313

14-
[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.
14+
[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.
1515

1616
</Note>
1717

1818
<Intro>
1919

20-
`preinit` lets you eagerly fetch and evaluate a stylesheet or external script.
20+
`preinit` memungkinkan Anda mengambil dan mengevaluasi *stylesheet* atau skrip eksternal dengan cepat.
2121

2222
```js
2323
preinit("https://example.com/script.js", {as: "script"});
@@ -29,11 +29,11 @@ preinit("https://example.com/script.js", {as: "script"});
2929

3030
---
3131

32-
## Reference {/*reference*/}
32+
## Referensi {/*reference*/}
3333

3434
### `preinit(href, options)` {/*preinit*/}
3535

36-
To preinit a script or stylesheet, call the `preinit` function from `react-dom`.
36+
Untuk melakukan inisialisasi terhadap sebuah skrip atau *stylesheet*, panggil fungsi `preinit` dari `react-dom`.
3737

3838
```js
3939
import { preinit } from 'react-dom';
@@ -45,42 +45,42 @@ function AppRoot() {
4545

4646
```
4747

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

50-
The `preinit` function provides the browser with a hint that it should start downloading and executing the given resource, which can save time. Scripts that you `preinit` are executed when they finish downloading. Stylesheets that you preinit are inserted into the document, which causes them to go into effect right away.
50+
Fungsi `preinit` memberikan petunjuk kepada browser bahwa untuk mulai mengunduh dan mengeksekusi sumber daya yang diberikan, yang dapat menghemat waktu. Skrip yang kamu `preinit` akan dieksekusi segera setelah selesai diunduh. *Stylesheet* yang kamu `preinit` akan langsung dimasukkan ke dalam dokumen, sehingga langsung berlaku saat itu juga.
5151

52-
#### Parameters {/*parameters*/}
52+
#### Parameter {/*parameters*/}
5353

54-
* `href`: a string. The URL of the resource you want to download and execute.
55-
* `options`: an object. It contains the following properties:
56-
* `as`: a required string. The type of resource. Its possible values are `script` and `style`.
57-
* `precedence`: a string. Required with stylesheets. Says where to insert the stylesheet relative to others. Stylesheets with higher precedence can override those with lower precedence. The possible values are `reset`, `low`, `medium`, `high`.
58-
* `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"`.
59-
* `integrity`: a string. A cryptographic hash of the resource, to [verify its authenticity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
60-
* `nonce`: a string. A cryptographic [nonce to allow the resource](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) when using a strict Content Security Policy.
61-
* `fetchPriority`: a string. Suggests a relative priority for fetching the resource. The possible values are `auto` (the default), `high`, and `low`.
54+
* `href`: sebuah string. URL sumber daya yang ingin Anda unduh dan jalankan.
55+
* `options`: sebuah objek. Ini berisi properti-properti berikut:
56+
* `as`: string yang diperlukan. Jenis sumber daya. Nilai yang memungkinkan adalah `script` and `style`.
57+
* `precedence`: sebuah string. Wajib diisi untuk stylesheet. Menunjukkan di mana stylesheet akan disisipkan relatif terhadap stylesheet lainnya. Stylesheet dengan prioritas lebih tinggi dapat menimpa(override) stylesheet dengan prioritas lebih rendah. Nilai yang memungkinkan adalah: `reset`, `low`, `medium`, `high`.
58+
* `crossOrigin`: sebuah string. The [Kebijakan CORS](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) yang akan digunakan. Nilai yang mungkin adalah `anonymous` dan `use-credentials`.
59+
* `integrity`: sebuah string. Hash kriptografi sumber daya, untuk [memverifikasi keasliannya](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
60+
* `nonce`: sebuah string. Sebuah kriptografi [*nonce* untuk mengizinkan sumber daya](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) ketika menggunakan *Content Security Policy* yang ketat.
61+
* `fetchPriority`: sebuah string. Menyarankan prioritas relatif untuk mengambil sumber daya. Nilai yang memungkinkan adalah `auto` (default), `high`, dan `low`.
6262

63-
#### Returns {/*returns*/}
63+
#### Kembalian {/*returns*/}
6464

65-
`preinit` returns nothing.
65+
`preinit` tidak mengembalikan apa pun.
6666

67-
#### Caveats {/*caveats*/}
67+
#### Peringatan {/*caveats*/}
6868

69-
* Multiple calls to `preinit` with the same `href` have the same effect as a single call.
70-
* In the browser, you can call `preinit` in any situation: while rendering a component, in an Effect, in an event handler, and so on.
71-
* In server-side rendering or when rendering Server Components, `preinit` only has an effect if you call it while rendering a component or in an async context originating from rendering a component. Any other calls will be ignored.
69+
* Beberapa pemanggilan `preinit` dengan `href` memiliki efek yang sama dengan panggilan tunggal.
70+
* Di browser, Anda dapat memanggil `preinit` dalam situasi apa pun: saat me-*render* komponen, di *Effect*, di *event handler*, dan sebagainya.
71+
* Dalam rendering sisi server atau saat me-render Komponen Server, `preinit` hanya memiliki efek jika Anda memanggilnya saat me-render komponen atau dalam konteks asinkronisasi yang berasal dari rendering komponen. Pemanggilan lainnya akan diabaikan.
7272

7373
---
7474

75-
## Usage {/*usage*/}
75+
## Penggunaan {/*usage*/}
7676

77-
### Preiniting when rendering {/*preiniting-when-rendering*/}
77+
### Preiniting awal saat me-render {/*preiniting-when-rendering*/}
7878

79-
Call `preinit` when rendering a component if you know that it or its children will use a specific resource, and you're OK with the resource being evaluated and thereby taking effect immediately upon being downloaded.
79+
Panggil `preinit` saat me-*render* komponen jika Anda mengetahui bahwa komponen tersebut atau anak komponennya akan menggunakan sumber daya tertentu, dan Anda setuju sumber daya tersebut langsung dievaluasi serta berlaku segera setelah selesai diunduh.
8080

8181
<Recipes titleText="Examples of preiniting">
8282

83-
#### Preiniting an external script {/*preiniting-an-external-script*/}
83+
#### Preiniting skrip eksternal {/*preiniting-an-external-script*/}
8484

8585
```js
8686
import { preinit } from 'react-dom';
@@ -91,11 +91,11 @@ function AppRoot() {
9191
}
9292
```
9393

94-
If you want the browser to download the script but not to execute it right away, use [`preload`](/reference/react-dom/preload) instead. If you want to load an ESM module, use [`preinitModule`](/reference/react-dom/preinitModule).
94+
Jika Anda ingin agar browser hanya mengunduh skrip tanpa langsung mengeksekusinya, gunakan [`preload`](/reference/react-dom/preload). Jika Anda ingin memuat modul ESM, gunakan [`preinitModule`](/reference/react-dom/preinitModule).
9595

9696
<Solution />
9797

98-
#### Preiniting a stylesheet {/*preiniting-a-stylesheet*/}
98+
#### Preiniting stylesheet {/*preiniting-a-stylesheet*/}
9999

100100
```js
101101
import { preinit } from 'react-dom';
@@ -106,17 +106,17 @@ function AppRoot() {
106106
}
107107
```
108108

109-
The `precedence` option, which is required, lets you control the order of stylesheets within the document. Stylesheets with higher precedence can overrule those with lower precedence.
109+
Opsi `precedence` yang wajib diisi memungkinkan Anda mengontrol urutan stylesheet di dalam dokumen. Stylesheet dengan prioritas lebih tinggi dapat menimpa stylesheet dengan prioritas lebih rendah.
110110

111-
If you want to download the stylesheet but not to insert it into the document right away, use [`preload`](/reference/react-dom/preload) instead.
111+
Jika Anda ingin mengunduh stylesheet tanpa langsung menyisipkannya ke dalam dokumen, gunakan [`preload`](/reference/react-dom/preload).
112112

113113
<Solution />
114114

115115
</Recipes>
116116

117-
### Preiniting in an event handler {/*preiniting-in-an-event-handler*/}
117+
### Preiniting pada event handler {/*preiniting-in-an-event-handler*/}
118118

119-
Call `preinit` in an event handler before transitioning to a page or state where external resources will be needed. This gets the process started earlier than if you call it during the rendering of the new page or state.
119+
Panggil `preinit` dalam *event handler* sebelum bertransisi ke halaman atau state yang membutuhkan sumber daya eksternal. Hal ini akan memulai proses lebih awal dibandingkan jika Anda memanggilnya saat merender halaman atau state baru.
120120

121121
```js
122122
import { preinit } from 'react-dom';

0 commit comments

Comments
 (0)