Define the shape of the handle export if you want to use scripts. Combine it with your own handle type to add scripts to your route.
handle
scripts
Add a scripts function that access the route's loader data
export const handle: ExternalScriptsHandle<SerializeFrom<typeof loader>> = { scripts(loaderData) { ... }} Copy
export const handle: ExternalScriptsHandle<SerializeFrom<typeof loader>> = { scripts(loaderData) { ... }}
Add a static scripts array
export const handle: ExternalScriptsHandle = { scripts: [...]} Copy
export const handle: ExternalScriptsHandle = { scripts: [...]}
Extend it with your own handle type
interface Handle<Data = unknown> extends ExternalScriptsHandle<Data> { // extra things here}export const handle: Handle = { scripts, // define scripts here // and any other handle properties here} Copy
interface Handle<Data = unknown> extends ExternalScriptsHandle<Data> { // extra things here}export const handle: Handle = { scripts, // define scripts here // and any other handle properties here}
Optional
Define the shape of the
handle
export if you want to usescripts
. Combine it with your ownhandle
type to addscripts
to your route.Description
Add a scripts function that access the route's loader data
Example
Description
Add a static scripts array
Example
Description
Extend it with your own handle type
Example