Function use_is_first_mount

Source
pub fn use_is_first_mount<'hook>() -> impl 'hook + Hook<Output = bool>
Expand description

A hook returns true if component is just mounted (on first render) and false otherwise.

§Example

use yew_hooks::prelude::*;

#[function_component(IsFirstMount)]
fn is_first_mount() -> Html {
    let is_first = use_is_first_mount();
    
    html! {
        <>
            { is_first }
        </>
    }
}

§Note

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

pub fn use_is_first_mount() -> bool {
    /* implementation omitted */
}