Skip to content

Commit 9b99ab2

Browse files
committed
translate addons-shallow-compare docs
1 parent 3110dca commit 9b99ab2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

content/docs/addons-shallow-compare.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ var shallowCompare = require('react-addons-shallow-compare'); // ES5 with npm
1919

2020
## Overview {#overview}
2121

22-
Before [`React.PureComponent`](/docs/react-api.html#reactpurecomponent) was introduced, `shallowCompare` was commonly used to achieve the same functionality as [`PureRenderMixin`](pure-render-mixin.html) while using ES6 classes with React.
22+
Trước khi [`React.PureComponent`](/docs/react-api.html#reactpurecomponent) được giới thiệu, `shallowCompare` thường được sử dụng có chức năng tương tự như [`PureRenderMixin`](pure-render-mixin.html) trong khi sử dụng các lớp ES6 với React.
2323

24-
If your React component's render function is "pure" (in other words, it renders the same result given the same props and state), you can use this helper function for a performance boost in some cases.
24+
Nếu render function của React component là "thuần" (nói một cách khác, nó trả về cùng một kết quả với cùng props state), bạn có thể dùng helper function để tăng cường hiệu suất trong một số trường hợp.
2525

26-
Example:
26+
Ví dụ:
2727

2828
```js
2929
export class SampleComponent extends React.Component {
@@ -37,8 +37,8 @@ export class SampleComponent extends React.Component {
3737
}
3838
```
3939

40-
`shallowCompare` performs a shallow equality check on the current `props` and `nextProps` objects as well as the current `state` and `nextState` objects.
41-
It does this by iterating on the keys of the objects being compared and returning true when the values of a key in each object are not strictly equal.
40+
`shallowCompare` thực hiện kiểm tra shallow equality ở các đối tượng `props``nextProps` hiện tại cũng như các đối tượng `state``nextState` hiện tại. Nó thực hiện điều này bằng cách thực hiện lặp đi lặp lại trên các khóa của đối tượng được so sánh và trả về true khi các giá trị của khóa ở mỗi đối tượng không hoàn toàn bằng nhau.
4241

43-
`shallowCompare` returns `true` if the shallow comparison for props or state fails and therefore the component should update.
44-
`shallowCompare` returns `false` if the shallow comparison for props and state both pass and therefore the component does not need to update.
42+
`shallowCompare` trả về `true` nếu phép so sánh shallow cho props hoặc state thất bại và component sẽ được cập nhật.
43+
44+
`shallowCompare` trả về `false` nếu phép so sánh shallow cho props hoặc state thành công và component không cần cập nhật.

0 commit comments

Comments
 (0)