Перейти к содержанию

renderToString

renderToString

1
2
3
4
5
6
7
function renderToString<T>(
  fn: () => T,
  options?: {
    nonce?: string;
    renderId?: string;
  }
): string;

Renders to a string synchronously. The function also generates a script tag for progressive hydration. Options include eventNames to listen to before the page loads and play back on hydration, and nonce to put on the script tag.

renderId is used to namespace renders when having multiple top level roots.

1
const html = renderToString(App);

Options

Name Type Description
nonce string The nonce to use for the script tag.
renderId string The id to use for the script tag.

Комментарии