use csr feature so that reactivity runs

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

View file

@ -9,7 +9,7 @@ codegen-units = 1
lto = true lto = true
[dependencies] [dependencies]
leptos = { path = "../../leptos" } leptos = { path = "../../leptos", features = ["csr"] }
console_error_panic_hook = "0.1.7" console_error_panic_hook = "0.1.7"
[dev-dependencies] [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 // 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 { pub fn counter(initial_value: i32, step: u32) -> impl IntoView {
let count = RwSignal::new(Count::new(initial_value, step)); 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 // the function name is the same as the HTML tag name
div() div()
@ -48,6 +51,7 @@ impl Count {
} }
pub fn value(&self) -> i32 { pub fn value(&self) -> i32 {
leptos::logging::log!("value = {}", self.value);
self.value self.value
} }