MCPcopy Create free account
hub / github.com/TanStack/router / ScriptOnce

Function ScriptOnce

packages/react-router/src/ScriptOnce.tsx:7–21  ·  view source on GitHub ↗
({ children }: { children: string })

Source from the content-addressed store, hash-verified

5 * Server-only helper to emit a script tag exactly once during SSR.
6 */
7export function ScriptOnce({ children }: { children: string }) {
8 const router = useRouter()
9 if (!(isServer ?? router.isServer)) {
10 return null
11 }
12
13 return (
14 <script
15 nonce={router.options.ssr?.nonce}
16 dangerouslySetInnerHTML={{
17 __html: children + ';document.currentScript.remove()',
18 }}
19 />
20 )
21}

Callers

nothing calls this directly

Calls 1

useRouterFunction · 0.90

Tested by

no test coverage detected