Function dioxus_html::document::head::Script
source · pub fn Script(props: ScriptProps) -> ElementExpand description
Render a script tag into the head of the page.
If present, the children of the script component must be a single static or formatted string. If there are more children or the children contain components, conditionals, loops, or fragments, the script will not be added.
Any scripts you add will be deduplicated by their src attribute (if present).
§Example
fn LoadScript() -> Element {
rsx! {
// You can use the Script component to render a script tag into the head of the page
Script {
src: asset!("./assets/script.js"),
}
}
}Any updates to the props after the first render will not be reflected in the head.