fix components that take no arguments

This commit is contained in:
Evan Almloff committed 2024-01-11 11:11:44 -06:00
1 parent 404c864246
commit 1794debf79
24 files changed
+98 -78

No files matched your search

+2 -2
View File
@@ -17,8 +17,8 @@ struct Testing<'a> {
borrowed: &'a RefCell<Vec<Element>>,
}
fn unsafe_child_component<'a>(cx: Scope<'a, Testing<'a>>) -> Element {
let Testing { borrowed } = cx.props;
fn unsafe_child_component<'a>(cx: Testing) -> Element {
let Testing { borrowed } = cx;
let borrowed_temporary_data =
cx.use_hook(|| String::from("This data is only valid for the lifetime of the child"));
@@ -17,8 +17,8 @@ struct Testing<'a> {
borrowed: &'a Vec<u32>,
}
fn unsafe_child_component<'a>(cx: Scope<'a, Testing<'a>>) -> Element {
fn unsafe_child_component<'a>(cx: Testing) -> Element {
cx.render(rsx! {
div { "{cx.props.borrowed:?}" }
div { "{cx.borrowed:?}" }
})
}