leptos-use/docs/book/src/get_started.md

37 lines
778 B
Markdown
Raw Normal View History

2023-05-15 01:52:02 +01:00
# Get Started
## Installation
```shell
cargo add leptos-use
```
## Examples
2023-05-27 03:00:08 +01:00
- [Examples Directory](https://github.com/Synphonyte/leptos-use/tree/main/examples)
2023-05-15 01:52:02 +01:00
## Usage Example
Simply import the functions you need from `leptos-use`
```rust,noplayground
2023-06-02 13:38:01 +01:00
use leptos::*;
use leptos_use::{use_mouse, UseMouseReturn};
2023-05-15 01:52:02 +01:00
#[component]
2023-07-27 18:06:36 +01:00
fn Demo() -> impl IntoView {
let UseMouseReturn { x, y, .. } = use_mouse();
2023-05-15 01:52:02 +01:00
view! { cx,
2023-06-02 13:38:01 +01:00
{x} " x " {y}
2023-05-15 01:52:02 +01:00
}
}
```
Please refer to the [functions list](functions.md) for more details.
## Stable Rust
2023-08-31 17:22:19 +01:00
Just like `leptos` this library can be safely run on stable rust.
In the [Getting Started section](https://leptos-rs.github.io/leptos/02_getting_started.html)
of the `leptos` docs you can read more about what this means.