From d9b60fb9f101376094366461d7645e81cdd2d533 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Tue, 10 Dec 2024 14:49:45 +0300 Subject: [PATCH] fix(item list): make item list reactive. --- src/app.rs | 2 +- src/components/items_list.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app.rs b/src/app.rs index 66d86a0..0ae5007 100644 --- a/src/app.rs +++ b/src/app.rs @@ -28,7 +28,7 @@ pub fn App() -> impl IntoView { // Form component for adding new items. // Component to display the list of items. - + } } diff --git a/src/components/items_list.rs b/src/components/items_list.rs index 202c92b..08d3187 100644 --- a/src/components/items_list.rs +++ b/src/components/items_list.rs @@ -5,12 +5,12 @@ use leptos::*; use crate::models::item::Item; #[component] -pub fn ItemsList(items: Vec) -> impl IntoView { +pub fn ItemsList(items: ReadSignal>) -> impl IntoView { view! {

{ "Items" }

    - {items.iter().enumerate().map(|(i, item)| view! { + {move || items.get().iter().enumerate().map(|(i, item)| view! {
  • { item.name.clone() } - { item.description.clone() }