mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-24 09:09:21 -05:00
845 B
845 B
Get Started
Installation
cargo add leptos-use
Examples
Usage Example
Simply import the functions you need from leptos-use
use leptos::*;
use leptos_use::{use_mouse, UseMouseReturn};
#[component]
fn Demo() -> impl IntoView {
let UseMouseReturn { x, y, .. } = use_mouse();
view! { cx,
{x} " x " {y}
}
}
Please refer to the functions list for more details.
Stable Rust
By default — like leptos
— the library assumes you're using the
nightly Rust toolchain. This allows for more ergonomic use of signals.
If you want to use stable Rust, you have to enable the stable
crate feature.
leptos-use = { version = "...", features = ["stable"] }