mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-03-13 09:09:48 -04:00
23 lines
569 B
Rust
23 lines
569 B
Rust
use leptos::*;
|
|
use leptos_use::docs::demo_or_body;
|
|
use leptos_use::use_cookie;
|
|
|
|
#[component]
|
|
fn Demo() -> impl IntoView {
|
|
if let Some(cookie) = use_cookie("auth") {
|
|
view! { <div>"'auth' cookie set to " <code>"`" {cookie.value().to_string()} "`"</code></div> }
|
|
.into_view()
|
|
} else {
|
|
view! { <div>"No 'auth' cookie set"</div> }
|
|
.into_view()
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
_ = console_log::init_with_level(log::Level::Debug);
|
|
console_error_panic_hook::set_once();
|
|
|
|
mount_to(demo_or_body(), || {
|
|
view! { <Demo/> }
|
|
})
|
|
}
|