Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

inline-scripts.tsx

30 lines773 Bytes

1import { createFileRoute } from '@tanstack/react-router'
2​
3export const Route = createFileRoute('/inline-scripts')({
4 head: () => ({
5 scripts: [
6 {
7 children:
8 'window.INLINE_SCRIPT_1 = true; console.log("Inline script 1 executed");',
9 },
10 {
11 children:
12 'window.INLINE_SCRIPT_2 = "test"; console.log("Inline script 2 executed");',
13 type: 'text/javascript',
14 },
15 ],
16 }),
17 component: InlineScriptsComponent,
18})
19​
20function InlineScriptsComponent() {
21 return (
22 <div className="p-2">
23 <h3 data-testid="inline-scripts-test-heading">Inline Scripts Test</h3>
24 <p>
25 This route tests inline script duplication prevention. Two inline
26 scripts should be loaded.
27 </p>
28 </div>
29 )