From 0ba53afa08e59ac24793ff210755f29f01797560 Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Wed, 12 Jun 2024 07:52:07 -0400 Subject: [PATCH] use `csr` feature so that reactivity runs --- examples/counter_without_macros/Cargo.toml | 2 +- examples/counter_without_macros/src/lib.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/counter_without_macros/Cargo.toml b/examples/counter_without_macros/Cargo.toml index 6c626a934..9b22121de 100644 --- a/examples/counter_without_macros/Cargo.toml +++ b/examples/counter_without_macros/Cargo.toml @@ -9,7 +9,7 @@ codegen-units = 1 lto = true [dependencies] -leptos = { path = "../../leptos" } +leptos = { path = "../../leptos", features = ["csr"] } console_error_panic_hook = "0.1.7" [dev-dependencies] diff --git a/examples/counter_without_macros/src/lib.rs b/examples/counter_without_macros/src/lib.rs index 128c8dce2..2881f6bfa 100644 --- a/examples/counter_without_macros/src/lib.rs +++ b/examples/counter_without_macros/src/lib.rs @@ -8,6 +8,9 @@ use leptos::{ // A component is really just a function call: it runs once to create the DOM and reactive system pub fn counter(initial_value: i32, step: u32) -> impl IntoView { let count = RwSignal::new(Count::new(initial_value, step)); + Effect::new(move |_| { + leptos::logging::log!("count = {:?}", count.get()); + }); // the function name is the same as the HTML tag name div() @@ -48,6 +51,7 @@ impl Count { } pub fn value(&self) -> i32 { + leptos::logging::log!("value = {}", self.value); self.value }