From 8f118fe3fd639443dbb26e1b934d8d8863eb5955 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 16 Nov 2022 22:20:41 -0800 Subject: [PATCH] chore: pull out for loop --- examples/simple_list.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/simple_list.rs b/examples/simple_list.rs index 872df878d..e92904b5e 100644 --- a/examples/simple_list.rs +++ b/examples/simple_list.rs @@ -6,7 +6,7 @@ fn main() { fn app(cx: Scope) -> Element { cx.render(rsx!( - div { id: "123123123", + div { // Use Map directly to lazily pull elements (0..10).map(|f| rsx! { "{f}" }), @@ -20,15 +20,14 @@ fn app(cx: Scope) -> Element { // Use optionals Some(rsx! { "Some" }), - // use a for loop or unterminated conditional - div { - for name in 0..10 { - rsx! { "{name}" } - } + // use a for loop + for name in 0..10 { + rsx! { "{name}" } + } - if true { - rsx!{ "hello world!" } - } + // Or even use an unterminated conditional + if true { + rsx!{ "hello world!" } } } ))