|
1 | 1 | --- |
2 | | -title: "React DOM Components" |
| 2 | +title: "Các thành phần React DOM" |
3 | 3 | --- |
4 | 4 |
|
5 | 5 | <Intro> |
6 | 6 |
|
7 | | -React supports all of the browser built-in [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Element) and [SVG](https://developer.mozilla.org/en-US/docs/Web/SVG/Element) components. |
| 7 | +React hỗ trợ tất cả các thành phần [HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Element) và [SVG](https://developer.mozilla.org/en-US/docs/Web/SVG/Element) được tích hợp sẵn của trình duyệt. |
8 | 8 |
|
9 | 9 | </Intro> |
10 | 10 |
|
11 | 11 | --- |
12 | 12 |
|
13 | | -## Common components {/*common-components*/} |
| 13 | +## Các thành phần phổ biến {/*common-components*/} |
14 | 14 |
|
15 | | -All of the built-in browser components support some props and events. |
| 15 | +Tất cả các thành phần trình duyệt tích hợp sẵn đều hỗ trợ một số thuộc tính và sự kiện. |
16 | 16 |
|
17 | | -* [Common components (e.g. `<div>`)](/reference/react-dom/components/common) |
| 17 | +* [Các thành phần phổ biến (ví dụ: `<div>`)](/reference/react-dom/components/common) |
18 | 18 |
|
19 | | -This includes React-specific props like `ref` and `dangerouslySetInnerHTML`. |
| 19 | +Điều này bao gồm các thuộc tính dành riêng cho React như `ref` và `dangerouslySetInnerHTML`. |
20 | 20 |
|
21 | 21 | --- |
22 | 22 |
|
23 | | -## Form components {/*form-components*/} |
| 23 | +## Các thành phần biểu mẫu {/*form-components*/} |
24 | 24 |
|
25 | | -These built-in browser components accept user input: |
| 25 | +Các thành phần trình duyệt tích hợp sẵn này chấp nhận đầu vào của người dùng: |
26 | 26 |
|
27 | 27 | * [`<input>`](/reference/react-dom/components/input) |
28 | 28 | * [`<select>`](/reference/react-dom/components/select) |
29 | 29 | * [`<textarea>`](/reference/react-dom/components/textarea) |
30 | 30 |
|
31 | | -They are special in React because passing the `value` prop to them makes them *[controlled.](/reference/react-dom/components/input#controlling-an-input-with-a-state-variable)* |
| 31 | +Chúng đặc biệt trong React vì việc truyền thuộc tính `value` cho chúng sẽ khiến chúng trở thành *[được kiểm soát.](/reference/react-dom/components/input#controlling-an-input-with-a-state-variable)* |
32 | 32 |
|
33 | 33 | --- |
34 | 34 |
|
35 | | -## Resource and Metadata Components {/*resource-and-metadata-components*/} |
| 35 | +## Các thành phần Tài nguyên và Siêu dữ liệu {/*resource-and-metadata-components*/} |
36 | 36 |
|
37 | | -These built-in browser components let you load external resources or annotate the document with metadata: |
| 37 | +Các thành phần trình duyệt tích hợp sẵn này cho phép bạn tải tài nguyên bên ngoài hoặc chú thích tài liệu bằng siêu dữ liệu: |
38 | 38 |
|
39 | 39 | * [`<link>`](/reference/react-dom/components/link) |
40 | 40 | * [`<meta>`](/reference/react-dom/components/meta) |
41 | 41 | * [`<script>`](/reference/react-dom/components/script) |
42 | 42 | * [`<style>`](/reference/react-dom/components/style) |
43 | 43 | * [`<title>`](/reference/react-dom/components/title) |
44 | 44 |
|
45 | | -They are special in React because React can render them into the document head, suspend while resources are loading, and enact other behaviors that are described on the reference page for each specific component. |
| 45 | +Chúng đặc biệt trong React vì React có thể hiển thị chúng vào đầu tài liệu, tạm dừng trong khi tài nguyên đang tải và ban hành các hành vi khác được mô tả trên trang tham khảo cho từng thành phần cụ thể. |
46 | 46 |
|
47 | 47 | --- |
48 | 48 |
|
49 | | -## All HTML components {/*all-html-components*/} |
| 49 | +## Tất cả các thành phần HTML {/*all-html-components*/} |
50 | 50 |
|
51 | | -React supports all built-in browser HTML components. This includes: |
| 51 | +React hỗ trợ tất cả các thành phần HTML trình duyệt tích hợp sẵn. Điều này bao gồm: |
52 | 52 |
|
53 | 53 | * [`<aside>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside) |
54 | 54 | * [`<audio>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio) |
@@ -154,38 +154,38 @@ React supports all built-in browser HTML components. This includes: |
154 | 154 |
|
155 | 155 | <Note> |
156 | 156 |
|
157 | | -Similar to the [DOM standard,](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) React uses a `camelCase` convention for prop names. For example, you'll write `tabIndex` instead of `tabindex`. You can convert existing HTML to JSX with an [online converter.](https://transform.tools/html-to-jsx) |
| 157 | +Tương tự như [tiêu chuẩn DOM,](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) React sử dụng quy ước `camelCase` cho tên thuộc tính. Ví dụ: bạn sẽ viết `tabIndex` thay vì `tabindex`. Bạn có thể chuyển đổi HTML hiện có sang JSX bằng một [công cụ chuyển đổi trực tuyến.](https://transform.tools/html-to-jsx) |
158 | 158 |
|
159 | 159 | </Note> |
160 | 160 |
|
161 | 161 | --- |
162 | 162 |
|
163 | | -### Custom HTML elements {/*custom-html-elements*/} |
| 163 | +### Các phần tử HTML tùy chỉnh {/*custom-html-elements*/} |
164 | 164 |
|
165 | | -If you render a tag with a dash, like `<my-element>`, React will assume you want to render a [custom HTML element.](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) In React, rendering custom elements works differently from rendering built-in browser tags: |
| 165 | +Nếu bạn hiển thị một thẻ có dấu gạch ngang, chẳng hạn như `<my-element>`, React sẽ cho rằng bạn muốn hiển thị một [phần tử HTML tùy chỉnh.](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) Trong React, việc hiển thị các phần tử tùy chỉnh hoạt động khác với việc hiển thị các thẻ trình duyệt tích hợp sẵn: |
166 | 166 |
|
167 | | -- All custom element props are serialized to strings and are always set using attributes. |
168 | | -- Custom elements accept `class` rather than `className`, and `for` rather than `htmlFor`. |
| 167 | +- Tất cả các thuộc tính của phần tử tùy chỉnh được tuần tự hóa thành chuỗi và luôn được đặt bằng các thuộc tính. |
| 168 | +- Các phần tử tùy chỉnh chấp nhận `class` thay vì `className` và `for` thay vì `htmlFor`. |
169 | 169 |
|
170 | | -If you render a built-in browser HTML element with an [`is`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is) attribute, it will also be treated as a custom element. |
| 170 | +Nếu bạn hiển thị một phần tử HTML trình duyệt tích hợp sẵn với thuộc tính [`is`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is), nó cũng sẽ được coi là một phần tử tùy chỉnh. |
171 | 171 |
|
172 | 172 | <Note> |
173 | 173 |
|
174 | | -[A future version of React will include more comprehensive support for custom elements.](https://github.com/facebook/react/issues/11347#issuecomment-1122275286) |
| 174 | +[Một phiên bản React trong tương lai sẽ bao gồm hỗ trợ toàn diện hơn cho các phần tử tùy chỉnh.](https://github.com/facebook/react/issues/11347#issuecomment-1122275286) |
175 | 175 |
|
176 | | -You can try it by upgrading React packages to the most recent experimental version: |
| 176 | +Bạn có thể thử bằng cách nâng cấp các gói React lên phiên bản thử nghiệm mới nhất: |
177 | 177 |
|
178 | 178 | - `react@experimental` |
179 | 179 | - `react-dom@experimental` |
180 | 180 |
|
181 | | -Experimental versions of React may contain bugs. Don't use them in production. |
| 181 | +Các phiên bản thử nghiệm của React có thể chứa lỗi. Không sử dụng chúng trong sản xuất. |
182 | 182 |
|
183 | 183 | </Note> |
184 | 184 | --- |
185 | 185 |
|
186 | | -## All SVG components {/*all-svg-components*/} |
| 186 | +## Tất cả các thành phần SVG {/*all-svg-components*/} |
187 | 187 |
|
188 | | -React supports all built-in browser SVG components. This includes: |
| 188 | +React hỗ trợ tất cả các thành phần SVG trình duyệt tích hợp sẵn. Điều này bao gồm: |
189 | 189 |
|
190 | 190 | * [`<a>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a) |
191 | 191 | * [`<animate>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/animate) |
@@ -256,20 +256,20 @@ React supports all built-in browser SVG components. This includes: |
256 | 256 |
|
257 | 257 | <Note> |
258 | 258 |
|
259 | | -Similar to the [DOM standard,](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) React uses a `camelCase` convention for prop names. For example, you'll write `tabIndex` instead of `tabindex`. You can convert existing SVG to JSX with an [online converter.](https://transform.tools/) |
260 | | - |
261 | | -Namespaced attributes also have to be written without the colon: |
262 | | - |
263 | | -* `xlink:actuate` becomes `xlinkActuate`. |
264 | | -* `xlink:arcrole` becomes `xlinkArcrole`. |
265 | | -* `xlink:href` becomes `xlinkHref`. |
266 | | -* `xlink:role` becomes `xlinkRole`. |
267 | | -* `xlink:show` becomes `xlinkShow`. |
268 | | -* `xlink:title` becomes `xlinkTitle`. |
269 | | -* `xlink:type` becomes `xlinkType`. |
270 | | -* `xml:base` becomes `xmlBase`. |
271 | | -* `xml:lang` becomes `xmlLang`. |
272 | | -* `xml:space` becomes `xmlSpace`. |
273 | | -* `xmlns:xlink` becomes `xmlnsXlink`. |
| 259 | +Tương tự như [tiêu chuẩn DOM,](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) React sử dụng quy ước `camelCase` cho tên thuộc tính. Ví dụ: bạn sẽ viết `tabIndex` thay vì `tabindex`. Bạn có thể chuyển đổi SVG hiện có sang JSX bằng một [công cụ chuyển đổi trực tuyến.](https://transform.tools/) |
| 260 | + |
| 261 | +Các thuộc tính có không gian tên cũng phải được viết không có dấu hai chấm: |
| 262 | + |
| 263 | +* `xlink:actuate` trở thành `xlinkActuate`. |
| 264 | +* `xlink:arcrole` trở thành `xlinkArcrole`. |
| 265 | +* `xlink:href` trở thành `xlinkHref`. |
| 266 | +* `xlink:role` trở thành `xlinkRole`. |
| 267 | +* `xlink:show` trở thành `xlinkShow`. |
| 268 | +* `xlink:title` trở thành `xlinkTitle`. |
| 269 | +* `xlink:type` trở thành `xlinkType`. |
| 270 | +* `xml:base` trở thành `xmlBase`. |
| 271 | +* `xml:lang` trở thành `xmlLang`. |
| 272 | +* `xml:space` trở thành `xmlSpace`. |
| 273 | +* `xmlns:xlink` trở thành `xmlnsXlink`. |
274 | 274 |
|
275 | 275 | </Note> |
0 commit comments