Uh oh!
There was an error while loading. Please reload this page.
docs: translation for useId - #524
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Size changesDetails📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
There was a problem hiding this comment.
More terms to introduce in the glossary, @resir014@r17x@mhaidarhanif@mazipan
| English | Indonesian |
|---|---|
| hardcode | kode keras (?), menuliskan secara langsung di dalam kode |
| server rendering | pe-render-an pada server |
| prefix | awalan |
| suffix | akhiran |
Let's discuss them here: #337 (comment)
| #### Caveats {/*caveats*/} | ||
| * `useId` is a Hook, so you can only call it **at the top level of your component** or your own Hooks. You can't call it inside loops or conditions. If you need that, extract a new component and move the state into it. | ||
| * `useId` adalah sebuah Hook, jadi Anda hanya dapat memanggilnya **di tingkat atas komponen Anda** atau Hook Anda sendiri. Anda tidak dapat memanggilnya di dalam loop atau kondisi. Jika Anda membutuhkannya, ekstrak komponen baru dan pindahkan *state* ke dalamnya. |
There was a problem hiding this comment.
| *`useId` adalah sebuah Hook, jadi Anda hanya dapat memanggilnya **di tingkat atas komponen Anda** atau Hook Anda sendiri. Anda tidak dapat memanggilnya di dalam loop atau kondisi. Jika Anda membutuhkannya, ekstrak komponen baru dan pindahkan *state* ke dalamnya. | |
| *`useId` adalah sebuah Hook, jadi Anda hanya dapat memanggilnya **di tingkat teratas komponen Anda** atau Hook Anda sendiri. Anda tidak dapat memanggilnya di dalam perulangan (*loops*) atau kondisi (*conditions*). Jika Anda membutuhkannya, ekstrak komponen baru dan pindahkan *state* ke dalamnya. |
Uh oh!
There was an error while loading. Please reload this page.
| ``` | ||
| However, hardcoding IDs like this is not a good practice in React. A component may be rendered more than once on the page--but IDs have to be unique! Instead of hardcoding an ID, generate a unique ID with `useId`: | ||
| Namun, memaksakan ID seperti ini bukanlah praktik yang baik di React. Sebuah komponen dapat dirender lebih dari sekali pada halaman—namun ID harus unik! Alih-alih melakukan pemaksaan ID, buat ID unik dengan `useId`: |
There was a problem hiding this comment.
| Namun, memaksakan ID seperti ini bukanlah praktik yang baik di React. Sebuah komponen dapat dirender lebih dari sekali pada halaman—namun ID harus unik! Alih-alih melakukan pemaksaan ID, buat ID unik dengan `useId`: | |
| Namun, menuliskan ID secara langsung di dalam kode (*hardcoding*) seperti ini bukanlah praktik yang baik di React. Sebuah komponen dapat dirender lebih dari sekali pada halaman—namun ID harus unik! Alih-alih melakukan pemaksaan ID, bangkitkan sebuah ID unik dengan `useId`: |
| <Pitfall> | ||
| With [server rendering](/reference/react-dom/server), **`useId` requires an identical component tree on the server and the client**. If the trees you render on the server and the client don't match exactly, the generated IDs won't match. | ||
| Dengan [rendering server](/reference/react-dom/server), **`useId` membutuhkan pohon komponen yang identik di server dan klien**. Jika pohon yang Anda render di server dan klien tidak sama persis, ID yang dihasilkan tidak akan cocok. |
There was a problem hiding this comment.
| Dengan [rendering server](/reference/react-dom/server), **`useId` membutuhkan pohon komponen yang identik di server dan klien**. Jika pohon yang Anda render di server dan klien tidak sama persis, ID yang dihasilkan tidak akan cocok. | |
| Dengan [pe-*render*-an pada *server*](/reference/react-dom/server), **`useId` membutuhkan pohon komponen yang identik di *server* dan klien**. Jika pohon yang Anda *render* di *server* dan klien tidak sama persis, ID yang dihasilkan tidak akan cocok. |
There was a problem hiding this comment.
I didn't fix it because the word pe-*render*-an is still under discussion
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
r17x
commented
May 7, 2023
Need to re-check @zainfathoni |
Uh oh!
There was an error while loading. Please reload this page.
mazipan
commented
May 8, 2023
Waiting your approval, @zainfathoni |
zainfathoni
commented
May 8, 2023
Okay, I'll review it tonight. |
zainfathoni
left a comment
There was a problem hiding this comment.
Thanks for addressing some of my previously requested changes.
Here is another review of the unaddressed change requests.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
r17x
commented
Jun 29, 2023
@zainfathoni need to recheck latest changes |
resir014
commented
Jul 27, 2023
@zainfathoni do you have time for re-review? |
zainfathoni
commented
Jul 27, 2023
Yes, I will have some time to review this weekend. Sorry for the delay. 🙏 |
zainfathoni
left a comment
There was a problem hiding this comment.
Approved with a minor suggestion. 💯
Thanks for making the requested changes! 🙏
Uh oh!
There was an error while loading. Please reload this page.
Closes#402
Description
Translate the useId page.
Page URL: https://id.react.dev/reference/react/useId