Skip to content

Commit 1c3b0c8

Browse files
Merge pull request #1 from danglequocbao001/feat/translate-addons
Feat/translate addons
2 parents fc52d95 + 7eecdd2 commit 1c3b0c8

File tree

4 files changed

+43
-43
lines changed

4 files changed

+43
-43
lines changed

content/blog/2020-12-21-data-fetching-with-react-server-components.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
tiêu đề: "Giới thiệu Zero-Bundle-Size React Server Components"
3-
tác giả: [gaearon,laurentan,josephsavona,sebmarkbage]
2+
title: "Giới thiệu Zero-Bundle-Size React Server Components"
3+
author: [gaearon,laurentan,josephsavona,sebmarkbage]
44
---
55

66
2020 là một năm dài. Năm cũ sắp hết, chúng tôi muốn mang đến một cập nhật đặc biệt cho mùa lễ hội này, đó là nghiên cứu của chúng tôi về zero-bundle-size **React Server Components**.

content/docs/addons-two-way-binding-helpers.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ import LinkedStateMixin from 'react-addons-linked-state-mixin'; // ES6
1717
var LinkedStateMixin = require('react-addons-linked-state-mixin'); // ES5 with npm
1818
```
1919

20-
## Overview {#overview}
20+
## Tổng quan {#overview}
2121

22-
`LinkedStateMixin` is an easy way to express two-way binding with React.
22+
`LinkedStateMixin` là một cách đơn giản để thể hiện ràng buộc (binding) hai chiều với React..
2323

24-
In React, data flows one way: from owner to child. We think that this makes your app's code easier to understand. You can think of it as "one-way data binding."
24+
Trong React, dữ liệu chạy theo một chiều: từ cha sang con. Chúng tôi nghĩ rằng điều này làm cho code của bạn trong ứng dụng dễ hiểu hơn. Bạn có thể coi nó là "ràng buộc (binding) dữ liệu một chiều".
2525

26-
However, there are lots of applications that require you to read some data and flow it back into your program. For example, when developing forms, you'll often want to update some React `state` when you receive user input. Or perhaps you want to perform layout in JavaScript and react to changes in some DOM element size.
26+
Tuy nhiên, có rất nhiều trường hợp ứng dụng yêu cầu bạn đọc một số dữ liệu đầu vào và đổ nó quay lại chương trình của bạn. Ví dụ: khi tạo forms, bạn thường muốn cập nhật một số `state` của React khi nhận được thông tin đầu vào của người dùng. Hoặc có lẽ bạn muốn thực hiện layout trong JavaScript react sẽ thay đổi một số kích thước phần tử DOM.
2727

28-
In React, you would implement this by listening to a "change" event, read from your data source (usually the DOM) and call `setState()` on one of your components. "Closing the data flow loop" explicitly leads to more understandable and easier-to-maintain programs. See [our forms documentation](/docs/forms.html) for more information.
28+
Trong React, bạn sẽ triển khai điều này bằng cách lắng nghe sự kiện "event", đọc từ nguồn dữ liệu của bạn (thường là DOM) và gọi `setState()` trên một trong các components. "Dừng vòng lặp dữ liệu" cho ra các chương trình dễ hiểu hơn và dễ bảo trì hơn. Xem [our forms documentation](/docs/forms.html) để biết thêm chi tiết.
2929

30-
Two-way binding -- implicitly enforcing that some value in the DOM is always consistent with some React `state` -- is concise and supports a wide variety of applications. We've provided `LinkedStateMixin`: syntactic sugar for setting up the common data flow loop pattern described above, or "linking" some data source to React `state`.
30+
Ràng buộc hai chiều -- ngầm thực thi rằng một số giá trị trong DOM luôn nhất quán với một số khác trong React `state` -- ngắn gọn và hỗ trợ nhiều ứng dụng. Chúng tôi đã cung cấp `LinkedStateMixin`: cú pháp để thiết lập mẫu vòng lặp luồng dữ liệu chung được mô tả ở trên, hoặc "kết nối" một số nguồn dữ liệu tới React `state`.
3131

3232
> Note:
3333
>
34-
> `LinkedStateMixin` is just a thin wrapper and convention around the `onChange`/`setState()` pattern. It doesn't fundamentally change how data flows in your React application.
34+
> `LinkedStateMixin` chỉ là một lớp vỏ và quy ước xung quanh `onChange`/`setState()`. Về cơ bản, nó không thay đổi cách dữ liệu hoạt động trong ứng dụng React của bạn.
3535
36-
## LinkedStateMixin: Before and After {#linkedstatemixin-before-and-after}
36+
## LinkedStateMixin: Trước và sau {#linkedstatemixin-before-and-after}
3737

38-
Here's a simple form example without using `LinkedStateMixin`:
38+
Đây là một ví dụ về biểu mẫu đơn giản mà không cần sử dụng `LinkedStateMixin`:
3939

4040
```javascript
4141
var createReactClass = require('create-react-class');
@@ -54,7 +54,7 @@ var NoLink = createReactClass({
5454
});
5555
```
5656

57-
This works really well and it's very clear how data is flowing, however, with a lot of form fields it could get a bit verbose. Let's use `LinkedStateMixin` to save us some typing:
57+
Điều này thực sự hoạt động tốt và rất rõ ràng về cách dữ liệu đang hoạt động, tuy nhiên, với nhiều trường biểu mẫu, nó có thể hơi dài dòng. Hãy dùng `LinkedStateMixin` để tiết kiệm thời gian viết:
5858

5959
```javascript{4,9}
6060
var createReactClass = require('create-react-class');
@@ -70,18 +70,18 @@ var WithLink = createReactClass({
7070
});
7171
```
7272

73-
`LinkedStateMixin` adds a method to your React component called `linkState()`. `linkState()` returns a `valueLink` object which contains the current value of the React state and a callback to change it.
73+
`LinkedStateMixin` thêm một phương thức vào thành phần React của bạn được gọi là `linkState()`. `linkState()` trả về một `valueLink` đối tượng chứa giá trị hiện tại của React và một lệnh gọi lại để thay đổi trạng thái của nó.
7474

75-
`valueLink` objects can be passed up and down the tree as props, so it's easy (and explicit) to set up two-way binding between a component deep in the hierarchy and state that lives higher in the hierarchy.
75+
`valueLink` object có thể được đưa lên và xuống "tree" làm props, vì vậy nó dễ dàng (và rõ ràng) dùng để thiết lập ràng buộc hai chiều giữa một thành phần nằm sâu trong hệ thống phân cấp và trạng thái tồn tại cao hơn trong hệ thống phân cấp.
7676

77-
Note that checkboxes have a special behavior regarding their `value` attribute, which is the value that will be sent on form submit if the checkbox is checked (defaults to `on`). The `value` attribute is not updated when the checkbox is checked or unchecked. For checkboxes, you should use `checkedLink` instead of `valueLink`:
77+
Lưu ý rằng checkboxes có một hình thức đặc biệt liên quan đến thuộc tính `value`, là giá trị sẽ được truyền đi khi gửi biểu mẫu nếu checkboxes được chọn (mặc định là `on`). Thuộc tính `value` không được cập nhật khi hộp kiểm được chọn hoặc bỏ chọn. Đối với checkboxes, bạn nên dùng `checkedLink` thay cho `valueLink`:
7878
```
7979
<input type="checkbox" checkedLink={this.linkState('booleanValue')} />
8080
```
8181

8282
## Under the Hood {#under-the-hood}
8383

84-
There are two sides to `LinkedStateMixin`: the place where you create the `valueLink` instance and the place where you use it. To prove how simple `LinkedStateMixin` is, let's rewrite each side separately to be more explicit.
84+
Có hai mặt trong `LinkedStateMixin`: nơi bạn tạo ra `valueLink` và nơi bạn sử dụng nó. Để chứng minh một cách đơn giản `LinkedStateMixin` là gì, hãy viết lại từng cái một để rõ ràng hơn.
8585

8686
### valueLink Without LinkedStateMixin {#valuelink-without-linkedstatemixin}
8787

@@ -105,7 +105,7 @@ var WithoutMixin = createReactClass({
105105
});
106106
```
107107

108-
As you can see, `valueLink` objects are very simple objects that just have a `value` and `requestChange` prop. And `LinkedStateMixin` is similarly simple: it just populates those fields with a value from `this.state` and a callback that calls `this.setState()`.
108+
Bạn có thể thấy, đối tượng `valueLink` là những đối tượng rất đơn giản chỉ có `value` `requestChange`. Và `LinkedStateMixin` tương tự đơn giản như: nó chỉ điền vào các trường đó một giá trị từ `this.state` và một "callback" để gọi lại `this.setState()`.
109109

110110
### LinkedStateMixin Without valueLink {#linkedstatemixin-without-valuelink}
111111

@@ -128,4 +128,4 @@ var WithoutLink = createReactClass({
128128
});
129129
```
130130

131-
The `valueLink` prop is also quite simple. It simply handles the `onChange` event and calls `this.props.valueLink.requestChange()` and also uses `this.props.valueLink.value` instead of `this.props.value`. That's it!
131+
`valueLink` cũng khá đơn giản. Nó chỉ đơn giản là xử lý sự kiện `onChange` và gọi `this.props.valueLink.requestChange()` và cũng được dùng như `this.props.valueLink.value` thay cho `this.props.value`. Là vậy đó!

content/docs/addons.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,42 @@ permalink: docs/addons.html
88
>
99
> `React.addons` entry point is deprecated as of React v15.5. The add-ons have moved to separate modules, and some of them have been deprecated.
1010
11-
The React add-ons are a collection of useful utility modules for building React apps. **These should be considered experimental** and tend to change more often than the core.
11+
Add-ons trong React là một tập hợp các module tiện ích có ích (plugins hoặc libararies) để tạo ra các ứng dụng React. **Đây nên được coi là chưa thực sự hoàn chỉnh** và có xu hướng cập nhật cốt lõi thường xuyên.
1212

13-
- [`createFragment`](/docs/create-fragment.html), to create a set of externally-keyed children.
13+
- [`createFragment`](/docs/create-fragment.html), để tạo một tập hợp các children có khóa ngoài.
1414

15-
The add-ons below are in the development (unminified) version of React only:
15+
Add-ons bên dưới chỉ nằm trong phiên bản phát triển (chưa được tổng hợp) của React:
1616

17-
- [`Perf`](/docs/perf.html), a performance profiling tool for finding optimization opportunities.
18-
- [`ReactTestUtils`](/docs/test-utils.html), simple helpers for writing test cases.
17+
- [`Perf`](/docs/perf.html), một công cụ tạo thông tin hồ sơ để tìm kiếm các phương pháp tối ưu hóa.
18+
- [`ReactTestUtils`](/docs/test-utils.html), những công cụ trợ giúp đơn giản để viết các trường hợp kiểm thử (test case).
1919

20-
### Legacy Add-ons {#legacy-add-ons}
20+
### Add-ons kế thừa {#legacy-add-ons}
2121

22-
The add-ons below are considered legacy and their use is discouraged. They will keep working in observable future, but there is no further development.
22+
Add-ons bên dưới được coi là kế thừa và việc sử dụng chúng không được khuyến khích. Họ (developers) sẽ tiếp tục làm việc trong tương lai gần (để cải thiện, sửa lỗi), nhưng không thực sự có sự phát triển thêm (nghĩa là sự phát triển tập trung và dừng lại chỉ ở tính năng đặc thù).
2323

24-
- [`PureRenderMixin`](/docs/pure-render-mixin.html). Use [`React.PureComponent`](/docs/react-api.html#reactpurecomponent) instead.
25-
- [`shallowCompare`](/docs/shallow-compare.html), a helper function that performs a shallow comparison for props and state in a component to decide if a component should update. We recommend using [`React.PureComponent`](/docs/react-api.html#reactpurecomponent) instead.
26-
- [`update`](/docs/update.html). Use [`kolodny/immutability-helper`](https://github.com/kolodny/immutability-helper) instead.
27-
- [`ReactDOMFactories`](https://www.npmjs.com/package/react-dom-factories), pre-configured DOM factories to make React easier to use without JSX.
24+
- [`PureRenderMixin`](/docs/pure-render-mixin.html). Thay vì vậy, dùng [`React.PureComponent`](/docs/react-api.html#reactpurecomponent).
25+
- [`shallowCompare`](/docs/shallow-compare.html), một chức năng trợ giúp thực hiện so sánh sơ qua cho "props and state" trong một component để quyết định xem component đó có cập nhật hay không. Thay vì vậy, chúng tôi khuyên dùng [`React.PureComponent`](/docs/react-api.html#reactpurecomponent).
26+
- [`update`](/docs/update.html). Thay vì vậy, dùng [`kolodny/immutability-helper`](https://github.com/kolodny/immutability-helper).
27+
- [`ReactDOMFactories`](https://www.npmjs.com/package/react-dom-factories), DOM được cấu hình trước để làm React dùng dễ hơn mà không cần tới JSX.
2828

29-
### Deprecated Add-ons {#deprecated-add-ons}
29+
### Add-ons không được sử dụng nữa {#deprecated-add-ons}
3030

31-
- [`LinkedStateMixin`](/docs/two-way-binding-helpers.html) has been deprecated.
32-
- [`TransitionGroup` and `CSSTransitionGroup`](/docs/animation.html) have been deprecated in favor of [their drop-in replacements](https://github.com/reactjs/react-transition-group/tree/v1-stable).
31+
- [`LinkedStateMixin`](/docs/two-way-binding-helpers.html) đã không cho phép dùng nữa.
32+
- [`TransitionGroup` and `CSSTransitionGroup`](/docs/animation.html) đã không còn được dùng, hãy dùng [their drop-in replacements](https://github.com/reactjs/react-transition-group/tree/v1-stable).
3333

34-
## Using React with Add-ons {#using-react-with-add-ons}
34+
## Dùng React với Add-ons {#using-react-with-add-ons}
3535

36-
You can install the add-ons individually from npm (e.g. `npm install react-addons-create-fragment`) and import them:
36+
Bạn có thể cài đặt Add-ons riêng lẻ từ npm (v.d. `npm install react-addons-create-fragment`) và "import" nó:
3737

3838
```javascript
3939
import createFragment from 'react-addons-create-fragment'; // ES6
4040
var createFragment = require('react-addons-create-fragment'); // ES5 with npm
4141
```
4242

43-
When using React 15 or earlier from a CDN, you can use `react-with-addons.js` instead of `react.js`:
43+
Khi sử dụng React 15 hoặc bản trước đó từ CDN, có thể dùng `react-with-addons.js` thay cho `react.js`:
4444

4545
```html
4646
<script src="https://unpkg.com/react@15/dist/react-with-addons.js"></script>
4747
```
4848

49-
The add-ons will be available via the `React.addons` global (e.g. `React.addons.TestUtils`).
49+
Add-ons sẽ có sẵn thông qua `React.addons` (v.d. `React.addons.TestUtils`).

content/docs/cdn-links.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@ prev: create-a-new-react-app.html
66
next: release-channels.html
77
---
88

9-
Both React and ReactDOM are available over a CDN.
9+
Cả React ReactDOM đều có sẵn thông qua CDN.
1010

1111
```html
1212
<script crossorigin src="https://unpkg.com/react@17/umd/react.development.js"></script>
1313
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
1414
```
1515

16-
The versions above are only meant for development, and are not suitable for production. Minified and optimized production versions of React are available at:
16+
Các phiên bản trên chỉ dành cho việc phát triển, và không thích hợp để tạo ra sản phẩm. Các phiên bản sản xuất thu nhỏ và tối ưu hóa của React có sẵn tại:
1717

1818
```html
1919
<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
2020
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
2121
```
2222

23-
To load a specific version of `react` and `react-dom`, replace `17` with the version number.
23+
Để tải một phiên bản cụ thể của `react` `react-dom`, thay `17` bằng số phiên bản.
2424

25-
### Why the `crossorigin` Attribute? {#why-the-crossorigin-attribute}
25+
### Tại sao là thuộc tính `crossorigin`? {#why-the-crossorigin-attribute}
2626

27-
If you serve React from a CDN, we recommend to keep the [`crossorigin`](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) attribute set:
27+
Nếu bạn dùng React từ CDN, chúng tôi khuyên bạn nên giữ tập thuộc tính [`crossorigin`](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes):
2828

2929
```html
3030
<script crossorigin src="..."></script>
3131
```
3232

33-
We also recommend to verify that the CDN you are using sets the `Access-Control-Allow-Origin: *` HTTP header:
33+
Chúng tôi cũng khuyên bạn nên xác định rằng CDN bạn đang sử dụng đặt `Access-Control-Allow-Origin: *` HTTP header:
3434

3535
![Access-Control-Allow-Origin: *](../images/docs/cdn-cors-header.png)
3636

37-
This enables a better [error handling experience](/blog/2017/07/26/error-handling-in-react-16.html) in React 16 and later.
37+
Điều này cho phép tốt hơn [error handling experience](/blog/2017/07/26/error-handling-in-react-16.html) trong React 16 và sau này.

0 commit comments

Comments
 (0)