Rendering

hydrationScript

Edit this page
import { generateHydrationScript, HydrationScript } from "solid-js/web"
import type { JSX } from "solid-js"
function generateHydrationScript(options: {
nonce?: string
eventNames?: string[]
}): string
function HydrationScript(props: {
nonce?: string
eventNames?: string[]
}): JSX.Element

Hydration Script is a special script that should be placed once on the page to bootstrap hydration before Solid's runtime has loaded. It comes both as a function that can be called and inserted in an HTML string, or as a Component if you are rendering JSX from the <html> tag.

The options are for the nonce to be put on the script tag and any event names for that Solid should capture before scripts have loaded and replay during hydration. These events are limited to those that Solid delegates which include most UI Events that are composed and bubble. By default it is only click and input events.

Report an issue with this page