use leptos::*; use leptos_use::docs::{demo_or_body, Note}; use leptos_use::use_active_element; #[component] fn Demo(cx: Scope) -> impl IntoView { let active_element = use_active_element(cx); let key = move || { format!( "{:?}", active_element.get() .map(|el| el.dataset().get("id")) .unwrap_or_default() ) }; view! { cx, "Select the inputs below to see the changes"
} />
"Current Active Element: " { key }
} } fn main() { _ = console_log::init_with_level(log::Level::Debug); console_error_panic_hook::set_once(); mount_to(demo_or_body(), |cx| { view! { cx, } }) }