chore: pull out for loop

This commit is contained in:
Jonathan Kelley committed 2022-11-16 22:20:41 -08:00
1 parent 77523bdc31
commit 8f118fe3fd
1 file changed
+8 -9
+8 -9
View File
@@ -6,7 +6,7 @@ fn main() {
fn app(cx: Scope) -> Element { fn app(cx: Scope) -> Element {
cx.render(rsx!( cx.render(rsx!(
div { id: "123123123", div {
// Use Map directly to lazily pull elements // Use Map directly to lazily pull elements
(0..10).map(|f| rsx! { "{f}" }), (0..10).map(|f| rsx! { "{f}" }),
@@ -20,15 +20,14 @@ fn app(cx: Scope) -> Element {
// Use optionals // Use optionals
Some(rsx! { "Some" }), Some(rsx! { "Some" }),
// use a for loop or unterminated conditional // use a for loop
div { for name in 0..10 {
for name in 0..10 { rsx! { "{name}" }
rsx! { "{name}" } }
}
if true { // Or even use an unterminated conditional
rsx!{ "hello world!" } if true {
} rsx!{ "hello world!" }
} }
} }
)) ))