pub fn use_update() -> Rc<impl Fn()>
Expand description

A hook returns a function that forces component to re-render when called.

Example

#[function_component(Update)]
fn update() -> Html {
    let update = use_update();

    let onclick = Callback::from(move |_| {
        update();
    });
     
    html! {
        <>
            <button {onclick}>{ "Update" }</button>
        </>
    }
}