wip: remove portals completely

This commit is contained in:
Jonathan Kelley committed 2021-12-14 21:46:19 -05:00
1 parent 8daf7a6ed8
commit 2fd56e7619
17 files changed
+259 -404

No files matched your search

+5 -5
View File
@@ -9,7 +9,7 @@ fn main() {
let _ = VirtualDom::new(Parent);
}
fn Parent(cx: Scope, _props: &()) -> Element {
fn Parent(cx: Scope<()>) -> Element {
let value = cx.use_hook(|_| String::new(), |f| f);
cx.render(rsx! {
@@ -25,11 +25,11 @@ struct ChildProps<'a> {
name: &'a str,
}
fn Child(cx: Scope, props: &ChildProps) -> Element {
fn Child<'a>(cx: Scope<'a, ChildProps<'a>>) -> Element {
cx.render(rsx! {
div {
h1 { "it's nested" }
Child2 { name: props.name }
Child2 { name: cx.props.name }
}
})
}
@@ -39,8 +39,8 @@ struct Grandchild<'a> {
name: &'a str,
}
fn Child2(cx: Scope, props: &Grandchild) -> Element {
fn Child2<'a>(cx: Scope<'a, Grandchild<'a>>) -> Element {
cx.render(rsx! {
div { "Hello {props.name}!" }
div { "Hello {cx.props.name}!" }
})
}