pub fn use_unmount<'hook, Callback>(
callback: Callback,
) -> impl 'hook + Hook<Output = ()>where
Callback: FnOnce() + 'static + 'hook,Expand description
A lifecycle hook that calls a function when the component will unmount.
§Example
use yew_hooks::prelude::*;
#[function_component(Unmount)]
fn unmount() -> Html {
use_unmount(|| {
debug!("Running clean-up of effect on unmount");
});
html! {
<>
</>
}
}§Note
When used in function components and hooks, this hook is equivalent to:
pub fn use_unmount<Callback>(callback: Callback)
where
Callback: FnOnce() + 'static,
{
/* implementation omitted */
}