pub fn use_search_param<'hook>(
param: String,
) -> impl 'hook + Hook<Output = Option<String>>Expand description
A sensor hook that tracks brower’s location search param value.
§Example
use yew_hooks::prelude::*;
#[function_component(UseSearchParam)]
fn search_param() -> Html {
let param = use_search_param("foo".to_string());
html! {
<>
<p>
<b>{ " Current search param: " }</b>
{ param.unwrap_or_default() }
</p>
</>
}
}§Note
When used in function components and hooks, this hook is equivalent to:
pub fn use_search_param(param: String) -> Option<String> {
/* implementation omitted */
}