fix: messed up how lifetimes worked, need to render once per component

This commit is contained in:
Jonathan Kelley committed 2021-10-29 21:43:21 -04:00
1 parent 0e9d5fc530
commit ba9e1dbb8f
33 files changed
+323 -184

No files matched your search

+3 -3
View File
@@ -10,7 +10,7 @@ fn test_borrowed_state() {
let _ = VirtualDom::new(Parent);
}
fn Parent((cx, _): Component<()>) -> Element {
fn Parent((cx, _): Scope<()>) -> Element {
let value = cx.use_hook(|_| String::new(), |f| &*f, |_| {});
rsx! {
@@ -28,7 +28,7 @@ struct ChildProps<'a> {
name: &'a str,
}
fn Child<'a>((cx, props): Component<'a, ChildProps>) -> Element<'a> {
fn Child<'a>((cx, props): Scope<'a, ChildProps>) -> Element<'a> {
rsx! {
div {
h1 { "it's nested" }
@@ -42,7 +42,7 @@ struct Grandchild<'a> {
name: &'a str,
}
fn Child2<'a>((cx, props): Component<'a, Grandchild>) -> Element<'a> {
fn Child2<'a>((cx, props): Scope<'a, Grandchild>) -> Element<'a> {
rsx! {
div { "Hello {props.name}!" }
}