静态 React DOM API
react-dom/static API 允许你为 React 组件生成静态 HTML。与流式 API 相比,它们的功能有限。一个 框架 可能会为你调用它们。你大多数组件不需要导入或使用它们。
🌐 The react-dom/static APIs let you generate static HTML for React components. They have limited functionality compared to the streaming APIs. A framework may call them for you. Most of your components don’t need to import or use them.
Web 流的静态 API
🌐 Static APIs for Web Streams
这些方法仅适用于具有 Web Streams 的环境,包括浏览器、Deno 和一些现代 edge 运行时:
🌐 These methods are only available in the environments with Web Streams, which includes browsers, Deno, and some modern edge runtimes:
prerender将 React 树渲染为带有 可读 Web 流 的静态 HTML。- Experimental only
resumeAndPrerender使用 Readable Web Stream 将预渲染的 React 树继续转换为静态 HTML。
Node.js 也包含这些方法以保持兼容性,但由于性能较差,不推荐使用。请改用 专用的 Node.js API。
🌐 Node.js also includes these methods for compatibility, but they are not recommended due to worse performance. Use the dedicated Node.js APIs instead.
Node.js 流的静态 API
🌐 Static APIs for Node.js Streams
这些方法仅在具有 Node.js 流 的环境中可用:
🌐 These methods are only available in the environments with Node.js Streams:
prerenderToNodeStream使用 Node.js 流 将 React 树渲染为静态 HTML。- Experimental only
resumeAndPrerenderToNodeStream使用 Node.js 流 将预渲染的 React 树继续转换为静态 HTML。