README first code example
LeoniePhiline opened this issue · 1 comments
LeoniePhiline commented
I might be misunderstanding this, but I believe the logging in the “Global hotkeys” example has a tiny mistake:
use leptos_hotkeys::prelude::*;
#[component]
pub fn SomeComponent() -> impl IntoView {
let (count, set_count) = create_signal(0);
// creating a global scope for the W key
use_hotkeys!(("w") => move |_| {
- logging::log!("s has been pressed");
+ logging::log!("w has been pressed");
set_count.update(|c| *c += 1);
});
// this is also a global scope for the S key!
use_hotkeys!(("s", "*") => move |_| {
- logging::log!("t has been pressed");
+ logging::log!("s has been pressed");
set_count.update(|c| *c -= 1);
});
view! {
<p>Current count: {count}</p>
}
}
friendlymatthew commented
Thanks for catching this lol. Feel free to open a PR with this fix! I can gladly do this, but if you want to contribute to the library, I don't want to steal an opportunity.