leptos_use

Function use_document

Source
pub fn use_document() -> UseDocument
Expand description

SSR safe document(). This returns just a new-type wrapper around Option<Document>. Calling this amounts to None on the server and Some(Document) on the client.

It provides some convenient methods for working with the document like body().

ยงUsage

let document = use_document();

// Returns `None` on the server but will not panic.
let body = document.body();