use csr feature so that reactivity runs

This commit is contained in:
Greg Johnston 2024-06-12 07:52:07 -04:00
parent c02d89ff74
commit 14cde1bc1e
2 changed files with 5 additions and 1 deletions

View file

@ -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]

View file

@ -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
}