• Load scripts defined by each route in a single place, often in root.

    Returns Element

    // Defines a `scripts` function in a route `handle`
    export const handle: ExternalScriptsHandle<SerializeFrom<typeof loader>> = {
    scripts(loaderData) { ... }
    }
    // Or define a scripts array directly
    export const handle: ExternalScriptsHandle = {
    scripts: [...]
    }
    // Then render ExternalScripts in your root
    return <ExternalScripts />