pub fn Script(props: ScriptProps) -> Element
Expand 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
document::Script {
src: asset!("/assets/script.js"),
}
}
}
Any updates to the props after the first render will not be reflected in the head.