wip: move children onto scope

This commit is contained in:
Jonathan Kelley committed 2021-11-01 03:49:32 -04:00
1 parent d1b294fff0
commit f438bbcfd2
6 files changed
+85 -19

No files matched your search

+18 -12
View File
@@ -64,10 +64,10 @@ fn create() {
"Hello, world!"
div {
div {
Fragment {
"hello"
"world"
}
// Fragment {
// "hello"
// "world"
// }
}
}
}
@@ -208,20 +208,26 @@ fn create_simple() {
#[test]
fn create_components() {
static App: FC<()> = |(cx, props)| {
cx.render(rsx! {
Child { "abc1" }
Child { "abc2" }
Child { "abc3" }
})
todo!()
// cx.render(rsx! {
// Child { "abc1" }
// Child { "abc2" }
// Child { "abc3" }
// })
};
static Child: FC<()> = |(cx, props)| {
#[derive(Props)]
struct ChildProps<'a> {
children: ScopeChildren<'a>,
}
fn Child<'a>((cx, props): Scope<'a, ChildProps<'a>>) -> Element {
cx.render(rsx! {
h1 {}
div { {cx.children()} }
div { {&props.children} }
p {}
})
};
}
let mut dom = new_dom(App, ());
let mutations = dom.rebuild();
+1 -1
View File
@@ -1,6 +1,6 @@
#![allow(unused, non_upper_case_globals)]
use dioxus::{prelude::*, DomEdit, TestDom};
use dioxus::{prelude::*, DomEdit, Mutations, TestDom};
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;