You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var PureRenderMixin =require('react-addons-pure-render-mixin'); // ES5 with npm
17
+
var PureRenderMixin =require('react-addons-pure-render-mixin'); // ES5 với npm
18
18
```
19
19
20
-
## Overview {#overview}
20
+
## Tổng quát {#overview}
21
21
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.
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.
39
39
40
-
> Note:
40
+
> Lưu ý:
41
41
>
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.
43
43
>
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