wip: move everything over to a stack dst
This commit is contained in:
1 parent
12a9758c3c
commit
0e9d5fc530
36 files changed
+224
-185
No files matched your search
@@ -10,17 +10,17 @@ fn test_borrowed_state() {
|
||||
let _ = VirtualDom::new(Parent);
|
||||
}
|
||||
|
||||
fn Parent((cx, _): Component<()>) -> DomTree {
|
||||
fn Parent((cx, _): Component<()>) -> Element {
|
||||
let value = cx.use_hook(|_| String::new(), |f| &*f, |_| {});
|
||||
|
||||
cx.render(rsx! {
|
||||
rsx! {
|
||||
div {
|
||||
Child { name: value }
|
||||
Child { name: value }
|
||||
Child { name: value }
|
||||
Child { name: value }
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Props)]
|
||||
@@ -28,13 +28,13 @@ struct ChildProps<'a> {
|
||||
name: &'a str,
|
||||
}
|
||||
|
||||
fn Child<'a>((cx, props): Component<'a, ChildProps>) -> DomTree<'a> {
|
||||
cx.render(rsx! {
|
||||
fn Child<'a>((cx, props): Component<'a, ChildProps>) -> Element<'a> {
|
||||
rsx! {
|
||||
div {
|
||||
h1 { "it's nested" }
|
||||
Child2 { name: props.name }
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Props)]
|
||||
@@ -42,8 +42,8 @@ struct Grandchild<'a> {
|
||||
name: &'a str,
|
||||
}
|
||||
|
||||
fn Child2<'a>((cx, props): Component<'a, Grandchild>) -> DomTree<'a> {
|
||||
cx.render(rsx! {
|
||||
fn Child2<'a>((cx, props): Component<'a, Grandchild>) -> Element<'a> {
|
||||
rsx! {
|
||||
div { "Hello {props.name}!" }
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user