React DOM 组件


通用组件

所有的浏览器内置组件都支持一些共同的属性与方法。

这些组件在 React 中可以使用 React 特有的属性,如 refdangerouslySetInnerHTML


表单组件

这些浏览器内置组件接收用户的输入:

value 作为 prop 传递给这些组件会将其变为 。


Resource and Metadata Components

These built-in browser components let you load external resources or annotate the document with metadata:

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.


所有的 HTML 组件

React 支持所有浏览器内置的组件,包括:


自定义 HTML 元素

如果你渲染一个带有连字符的标签,如 <my-element>,React 会认为你想要渲染一个 。在 React 中,渲染自定义元素与渲染内置的浏览器标签有所不同:

  • 所有自定义元素的 props 都将被序列化为字符串,并且总是使用属性(attribute)进行设置。
  • 自定义元素接受 class 而不是 className,接受 for 而不是 htmlFor

如果你使用 属性渲染一个内置的浏览器 HTML 元素,它也会被视为自定义元素。


所有 SVG 组件

React 支持所有浏览器内置的 SVG 组件,包括:

  • <hatch>
  • <hatchpath>