React DOM legacy server browser
一、作用
二、渲染为字符串
备注
renderToStringImpl()由 ReactDOMLegacyServerImpl#renderToStringImpl 实现
function renderToString(
children: ReactNodeList,
options?: ServerOptions,
): string {
return renderToStringImpl(
children,
options,
false,
'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server',
);
}
三、渲染为静态标记
备注
renderToStringImpl()由 ReactDOMLegacyServerImpl#renderToStringImpl 实现
function renderToStaticMarkup(
children: ReactNodeList,
options?: ServerOptions,
): string {
return renderToStringImpl(
children,
options,
true,
'The server used "renderToStaticMarkup" which does not support Suspense. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server',
);
}
四、类型
1. 服务器选项
type ServerOptions = {
identifierPrefix?: string;
};
五、转导
- 从 ReactDOMLegacyServerImpl#version 转导了
version(嗯, “ReactDOMLegacyServerImpl” 的 version 本身就是转导的 “shared/ReactVersion” ,为什么要再转一次)