Function use_title

Source
pub fn use_title<'hook>(title: String) -> impl 'hook + Hook<Output = ()>
Expand description

A side-effect hook that sets title of the page and restore previous title when unmount.

§Example

use yew_hooks::prelude::*;

#[function_component(Title)]
fn title() -> Html {
    use_title("This is an awesome title".to_string());
    
    html! {
        <>
        </>
    }
}

§Note

When used in function components and hooks, this hook is equivalent to:

pub fn use_title(title: String) {
    /* implementation omitted */
}