Interface ExternalScriptsHandle<Data>

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.

Add a scripts function that access the route's loader data

export const handle: ExternalScriptsHandle<SerializeFrom<typeof loader>> = {
scripts(loaderData) { ... }
}

Add a static scripts array

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
}
interface ExternalScriptsHandle<Data = unknown> {
    scripts?: ExternalScriptsFunction<Data> | ScriptDescriptor[];
}

Type Parameters

  • Data = unknown

Properties

Properties