本页还没有译文
本页 14 段还没译成日本語,下面显示的是英文原文。RSCStaticRouter
还没翻译译自英文(reactrouter.com)本页 14 段都还没译
unstable_RSCStaticRouter
Data
Warning
This API is experimental and subject to breaking changes in minor/patch releases. Please use with caution and pay very close attention to release notes for relevant changes.
Summary
Pre-renders an unstable_RSCPayload to HTML. Usually used in
unstable_routeRSCServerRequest's renderHTML callback.
import { createFromReadableStream } from "@vitejs/plugin-rsc/ssr";
import * as ReactDomServer from "react-dom/server.edge";
import {
unstable_RSCStaticRouter as RSCStaticRouter,
unstable_routeRSCServerRequest as routeRSCServerRequest,
} from "react-router";
routeRSCServerRequest({
request,
serverResponse,
createFromReadableStream,
nonce,
async renderHTML(getPayload, options) {
const payload = getPayload();
return await renderHTMLToReadableStream(
<RSCStaticRouter
getPayload={getPayload}
nonce={options.nonce}
/>,
{
...options,
bootstrapScriptContent,
formState: await payload.formState,
}
);
},
});Signature
function RSCStaticRouter({ getPayload, nonce }: RSCStaticRouterProps)Props
getPayload
A function that starts decoding of the unstable_RSCPayload. Usually passed
through from unstable_routeRSCServerRequest's renderHTML.
nonce
An optional nonce
used as the default for nonce-aware components such as <Links> and
<ScrollRestoration>.
AI 翻译查看英文原文