Function leptos_use::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();