Skip to content

Commit b9f38b9

Browse files
committed
translations for APIs references lazy
1 parent 201b76b commit b9f38b9

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/content/reference/react/lazy.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: lazy
44

55
<Intro>
66

7-
`lazy` lets you defer loading component's code until it is rendered for the first time.
7+
`lazy` memungkinkan Anda menunda pemuatan kode komponen hingga komponen tersebut dirender untuk pertama kalinya.
88

99
```js
1010
const SomeComponent = lazy(load)
@@ -16,63 +16,63 @@ const SomeComponent = lazy(load)
1616

1717
---
1818

19-
## Reference {/*reference*/}
19+
## Referensi {/*reference*/}
2020

2121
### `lazy(load)` {/*lazy*/}
2222

23-
Call `lazy` outside your components to declare a lazy-loaded React component:
23+
Panggil fungsi `lazy` di luar komponen apapun untuk mendeklarasikan *lazy-loaded* komponen React:
2424

2525
```js
2626
import { lazy } from 'react';
2727

2828
const MarkdownPreview = lazy(() => import('./MarkdownPreview.js'));
2929
```
3030

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

3333
#### Parameters {/*parameters*/}
3434

35-
* `load`: A function that returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) or another *thenable* (a Promise-like object with a `then` method). React will not call `load` until the first time you attempt to render the returned component. After React first calls `load`, it will wait for it to resolve, and then render the resolved value as a React component. Both the returned Promise and the Promise's resolved value will be cached, so React will not call `load` more than once. If the Promise rejects, React will `throw` the rejection reason for the nearest Error Boundary to handle.
35+
* `load`: Sebuah fungsi yang mengembalikan [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) atau *thenable* lain (sebuah objek yang mirip dengan *Promise* dan memiliki metode `then`). React tidak akan memanggil `load` sempai pertama kali And mencoba untuk merender komponen yang dikembalikan. Setelah React pertama kali memanggil `load`, React akan menunggu sampai komponen itu selesai, dan kemudian merender nilai yang telah diselesaikan sebagai komponen React. Baik *Promise* yang dikembalikan maupun nilai yang diselesaikan dari *Promise* akan dicache, sehingga React tidak akan memanggil `load` lebih dari satu kali. Jika *Promise* menolak, React akan `throw` alasan penolakan ke *Error Boundary* terdekat untuk ditangani.
3636

3737
#### Returns {/*returns*/}
3838

39-
`lazy` returns a React component you can render in your tree. While the code for the lazy component is still loading, attempting to render it will *suspend.* Use [`<Suspense>`](/reference/react/Suspense) to display a loading indicator while it's loading.
39+
`lazy` mengembalikan kompon React yang dapat Anda render di dalam *tree*. Ketika kode untuk komponen *lazy* masih dimuat, mencoba merendernya akan *suspend.* Gunakan [`<Suspense>`](/reference/react/Suspense) untuk menampilkan indikator pemuatan ketika komponen tersebut dimuat.
4040

4141
---
4242

43-
### `load` function {/*load*/}
43+
### fungsi `load` {/*load*/}
4444

4545
#### Parameters {/*load-parameters*/}
4646

47-
`load` receives no parameters.
47+
`load` tidak menerima parameter.
4848

4949
#### Returns {/*load-returns*/}
5050

51-
You need to return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) or some other *thenable* (a Promise-like object with a `then` method). It needs to eventually resolve to a valid React component type, such as a function, [`memo`](/reference/react/memo), or a [`forwardRef`](/reference/react/forwardRef) component.
51+
Anda perlu mengembalikan sebuah [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) atau *thenable* lain (sebuah objek yang mirip dengan *Promise* dan memiliki metode `then`). Pada akhirnya, komponen ini harus diselesaikan ke tipe komponen React yang valid, seperti sebuah fungsi, [`memo`](/reference/react/memo), atau [`forwardRef`](/reference/react/forwardRef) komponen.
5252

5353
---
5454

55-
## Usage {/*usage*/}
55+
## Penggunaan {/*usage*/}
5656

57-
### Lazy-loading components with Suspense {/*suspense-for-code-splitting*/}
57+
### Lazy-loading komponen dengan Suspense {/*suspense-for-code-splitting*/}
5858

59-
Usually, you import components with the static [`import`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) declaration:
59+
Biasanya, Anda mengimpor komponen dengan deklarasi statis [`import`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) :
6060

6161
```js
6262
import MarkdownPreview from './MarkdownPreview.js';
6363
```
6464

65-
To defer loading this component's code until it's rendered for the first time, replace this import with:
65+
Untuk menunda pemuatan jkode komponen ini hingga dirender untuk pertama kalinya, ganti *import* ini dengan:
6666

6767
```js
6868
import { lazy } from 'react';
6969

7070
const MarkdownPreview = lazy(() => import('./MarkdownPreview.js'));
7171
```
7272

73-
This code relies on [dynamic `import()`,](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) which might require support from your bundler or framework.
73+
Kode ini bergantung pada [dynamic `import()`,](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) yang mungkin memerlukan dukungan dari *bundler* atau *framework* yang Anda gunakan.
7474

75-
Now that your component's code loads on demand, you also need to specify what should be displayed while it is loading. You can do this by wrapping the lazy component or any of its parents into a [`<Suspense>`](/reference/react/Suspense) boundary:
75+
Setelah kode komponen Anda dimuat saat digunakan, Anda juga perlu menentukan apa yang harus ditampilkan ketika dimuat. Anda dapat melakukan ini dengan membungkus komponen *lazy* atau salah satu *parent* ke dalam [`<Suspense>`](/reference/react/Suspense):
7676

7777
```js {1,4}
7878
<Suspense fallback={<Loading />}>
@@ -81,7 +81,7 @@ Now that your component's code loads on demand, you also need to specify what sh
8181
</Suspense>
8282
```
8383

84-
In this example, the code for `MarkdownPreview` won't be loaded until you attempt to render it. If `MarkdownPreview` hasn't loaded yet, `Loading` will be shown in its place. Try ticking the checkbox:
84+
Pada contoh ini, kode untuk `MarkdownPreview` tidak akan dimuat hingga Anda mencoba merendernya. Jika `MarkdownPreview` belum dimuat, `Loading` atau indikator akan ditampilkan sebagai gantinya. Coba centang *checkbox* ini:
8585

8686
<Sandpack>
8787

@@ -175,17 +175,17 @@ body {
175175

176176
</Sandpack>
177177

178-
This demo loads with an artificial delay. The next time you untick and tick the checkbox, `Preview` will be cached, so there will be no loading state. To see the loading state again, click "Reset" on the sandbox.
178+
Demo ini dimuat dengan penundaan buatan. Lain kali Anda menghapus centang dan mencentang *checkbox*, `Preview` akan dicache, sehingga tidak akan ada status pemuatan. Untuk melihat status pemuatan lagi, Klik "Reset" pada *sandbox*.
179179

180-
[Learn more about managing loading states with Suspense.](/reference/react/Suspense)
180+
[Pelajari lebih lanjut tentang mengelola status pemuatan dengan Suspense.](/reference/react/Suspense)
181181

182182
---
183183

184-
## Troubleshooting {/*troubleshooting*/}
184+
## Pemecahan Masalah {/*troubleshooting*/}
185185

186-
### My `lazy` component's state gets reset unexpectedly {/*my-lazy-components-state-gets-reset-unexpectedly*/}
186+
### `lazy` komponen saya disetel ulang secara tidak terduka {/*my-lazy-components-state-gets-reset-unexpectedly*/}
187187

188-
Do not declare `lazy` components *inside* other components:
188+
Jangan deklarasikan `lazy` komponen *didalam* komponen lain:
189189

190190
```js {4-5}
191191
import { lazy } from 'react';
@@ -197,7 +197,7 @@ function Editor() {
197197
}
198198
```
199199

200-
Instead, always declare them at the top level of your module:
200+
Sebaiknya, selalu deklarasikan mereka di tingkat teratas modul Anda:
201201

202202
```js {3-4}
203203
import { lazy } from 'react';

0 commit comments

Comments
 (0)