Skip to content

Commit 7a09302

Browse files
authored
translate some comments
1 parent 0a2162f commit 7a09302

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/content/reference/react/Component.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,8 @@ class ScrollingList extends React.Component {
520520
}
521521
522522
getSnapshotBeforeUpdate(prevProps, prevState) {
523-
// Are we adding new items to the list?
524-
// Capture the scroll position so we can adjust scroll later.
523+
// Apakah kita menambahkan item baru ke dalam list?
524+
// Tangkap posisi scroll supaya kita dapat mengatur scroll nanti.
525525
if (prevProps.list.length < this.props.list.length) {
526526
const list = this.listRef.current;
527527
return list.scrollHeight - list.scrollTop;
@@ -530,9 +530,9 @@ class ScrollingList extends React.Component {
530530
}
531531
532532
componentDidUpdate(prevProps, prevState, snapshot) {
533-
// If we have a snapshot value, we've just added new items.
534-
// Adjust scroll so these new items don't push the old ones out of view.
535-
// (snapshot here is the value returned from getSnapshotBeforeUpdate)
533+
// Apabila kita memiliki nilai snapshot, kita baru saja menambahkan item baru.
534+
// Atur scroll supaya item-item baru ini tidak mendorong item-item lama ke luar tampilan.
535+
// (snapshot adalah nilai yang dikembalikan dari getSnapshotBeforeUpdate)
536536
if (snapshot !== null) {
537537
const list = this.listRef.current;
538538
list.scrollTop = list.scrollHeight - snapshot;
@@ -723,7 +723,7 @@ class Rectangle extends Component {
723723
nextProps.size.height === this.props.size.height &&
724724
nextState.isHovered === this.state.isHovered
725725
) {
726-
// Nothing has changed, so a re-render is unnecessary
726+
// Tidak ada yang berubah, jadi tidak perlu render ulang
727727
return false;
728728
}
729729
return true;
@@ -1048,9 +1048,9 @@ class Form extends Component {
10481048
};
10491049
10501050
static getDerivedStateFromProps(props, state) {
1051-
// Any time the current user changes,
1052-
// Reset any parts of state that are tied to that user.
1053-
// In this simple example, that's just the email.
1051+
// Setiap kali user saat ini berubah,
1052+
// Setel ulang bagian state mana pun yang terkait ke user itu.
1053+
// Dalam contoh simpel ini, hanya ada email.
10541054
if (props.userID !== state.prevUserID) {
10551055
return {
10561056
prevUserID: props.userID,
@@ -1359,12 +1359,12 @@ class ErrorBoundary extends React.Component {
13591359
}
13601360

13611361
static getDerivedStateFromError(error) {
1362-
// Update state so the next render will show the fallback UI.
1362+
// Perbarui state sehingga render selanjutnya menunjukkan UI fallback.
13631363
return { hasError: true };
13641364
}
13651365

13661366
componentDidCatch(error, info) {
1367-
// Example "componentStack":
1367+
// Contoh "componentStack":
13681368
// in ComponentThatThrows (created by App)
13691369
// in ErrorBoundary (created by App)
13701370
// in div (created by App)
@@ -1374,7 +1374,7 @@ class ErrorBoundary extends React.Component {
13741374

13751375
render() {
13761376
if (this.state.hasError) {
1377-
// You can render any custom fallback UI
1377+
// Anda dapat me-render UI fallback apa pun.
13781378
return this.props.fallback;
13791379
}
13801380

@@ -1805,7 +1805,7 @@ export default function ChatRoom({ roomId }) {
18051805
18061806
```js src/chat.js
18071807
export function createConnection(serverUrl, roomId) {
1808-
// A real implementation would actually connect to the server
1808+
// Sebuah implementasi nyata sebenarnya akan terhubung ke server.
18091809
return {
18101810
connect() {
18111811
console.log('✅ Connecting to "' + roomId + '" room at ' + serverUrl + '...');

0 commit comments

Comments
 (0)