客户端 React DOM API

react-dom/client API 允许你在客户端(在浏览器中)渲染 React 组件。这些 API 通常在你的应用的顶层使用,以初始化你的 React 树。框架 可能会为你调用它们。你的大部分组件不需要导入或使用它们。

¥The react-dom/client APIs let you render React components on the client (in the browser). These APIs are typically used at the top level of your app to initialize your React tree. A framework may call them for you. Most of your components don’t need to import or use them.


客户端 API

¥Client APIs

  • createRoot 允许你创建一个根以在浏览器 DOM 节点内显示 React 组件。

    ¥createRoot lets you create a root to display React components inside a browser DOM node.

  • hydrateRoot 允许你在浏览器 DOM 节点内显示 React 组件,其 HTML 内容先前由 react-dom/server 生成

    ¥hydrateRoot lets you display React components inside a browser DOM node whose HTML content was previously generated by react-dom/server.


浏览器支持

¥Browser support

React 支持所有流行的浏览器,包括 Internet Explorer 9 及更高版本。IE 9 和 IE 10 等较旧的浏览器需要一些 polyfill。

¥React supports all popular browsers, including Internet Explorer 9 and above. Some polyfills are required for older browsers such as IE 9 and IE 10.


React 中文网 - 粤ICP备13048890号