Skip to content

Commit d21b32a

Browse files
committed
Translate addons-pure-render-mixin
1 parent dc63a5b commit d21b32a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

content/docs/addons-pure-render-mixin.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ layout: docs
66
category: Add-Ons
77
---
88

9-
> Note:
9+
> Lưu ý:
1010
>
11-
> `PureRenderMixin` is a legacy add-on. Use [`React.PureComponent`](/docs/react-api.html#reactpurecomponent) instead.
11+
> `PureRenderMixin` được kế thừa từ add-on. Sử dụng [`React.PureComponent`](/docs/react-api.html#reactpurecomponent) thay thế.
1212
1313
**Importing**
1414

1515
```javascript
1616
import PureRenderMixin from 'react-addons-pure-render-mixin'; // ES6
17-
var PureRenderMixin = require('react-addons-pure-render-mixin'); // ES5 with npm
17+
var PureRenderMixin = require('react-addons-pure-render-mixin'); // ES5 với npm
1818
```
1919

20-
## Overview {#overview}
20+
## Tổng quát {#overview}
2121

22-
If your React component's render function renders the same result given the same props and state, you can use this mixin for a performance boost in some cases.
22+
Nếu function render của React component của bạn hiển thị cùng một kết quả với cùng prop và state, bạn có thể sử dụng mixin để tăng hiệu suất trong một số trường hợp.
2323

24-
Example:
24+
Ví dụ:
2525

2626
```js
2727
const createReactClass = require('create-react-class');
@@ -35,10 +35,10 @@ createReactClass({
3535
});
3636
```
3737

38-
Under the hood, the mixin implements [shouldComponentUpdate](/docs/component-specs.html#updating-shouldcomponentupdate), in which it compares the current props and state with the next ones and returns `false` if the equalities pass.
38+
Xem xét một cách kỹ lưỡng, mixin thực hiện [shouldComponentUpdate](/docs/component-specs.html#updating-shouldcomponentupdate), trong đó nó so sánh prop và state hiện tại với những cái tiếp theo và trả về `false` nếu chúng bằng nhau.
3939

40-
> Note:
40+
> Lưu ý:
4141
>
42-
> This only shallowly compares the objects. If these contain complex data structures, it may produce false-negatives for deeper differences. Only mix into components which have simple props and state, or use `forceUpdate()` when you know deep data structures have changed. Or, consider using [immutable objects](https://facebook.github.io/immutable-js/) to facilitate fast comparisons of nested data.
42+
> Đây chỉ là so sánh nông với các object. Nếu object chứa cấu trúc dữ liệu phức tạp, nó có thể tạo ra các trường hợp sai đối với sự khác nhau sâu trong nhiều cấp của object. Chỉ được dùng đối với component có prop và state đơn giản, hoặc dùng `forceUpdate()` khi bạn biết cấu trúc dữ liệu sâu bên trong đã thay đổi. Có thể cân nhắc sử dụng [immutable objects](https://facebook.github.io/immutable-js/) để dễ dàng so sánh các dữ liệu lồng nhau.
4343
>
44-
> Furthermore, `shouldComponentUpdate` skips updates for the whole component subtree. Make sure all the children components are also "pure".
44+
> Hơn nữa, `shouldComponentUpdate` bỏ qua cập nhật toàn bộ các component con. Hãy đảm bảo rằng tất cả các component con cũng là "pure".

0 commit comments

Comments
 (0)