pub fn use_before_unload<'hook>(
enabled: bool,
msg: String,
) -> impl 'hook + Hook<Output = ()>Expand description
A side-effect hook that shows browser alert when user try to reload or close the page.
§Example
use yew_hooks::prelude::*;
#[function_component(UseBeforeUnload)]
fn before_unload() -> Html {
use_before_unload(true, "You have unsaved changes, are you sure?".to_string());
html! {
<>
</>
}
}§Note
When used in function components and hooks, this hook is equivalent to:
pub fn use_before_unload(enabled: bool, msg: String) {
/* implementation omitted */
}