ScriptProps
An optional content-security-policy nonce for document scripts.
Compatibility
ReactAvailable in this renderer's browser integration.
React SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
PreactAvailable in this renderer's browser integration.
Preact SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
Import from @kasperrt/smolter/preact/document @kasperrt/smolter/react/document
Signature
interface ScriptProps {
nonce?: string;
}Contract
Contains nonce?: string. Scripts applies it to the inline bootstrap, JSON hydration payload, and browser module entry script.
import type { ScriptProps } from "@kasperrt/smolter/preact/document";
export function scriptsForRequest(nonce: string): ScriptProps {
return { nonce };
}Usage and limits
Generate and manage CSP nonces in the application’s server integration. ScrollRestoration accepts this shape for compatibility but emits no script and currently does not use nonce.
Fields
nonce
nonce?: string;