add component support
This commit is contained in:
1 parent
07da854455
commit
a0c7e4d78a
8 files changed
+62
-14
No files matched your search
+18
-1
@@ -21,7 +21,24 @@ fn app(cx: Scope) -> Element {
|
||||
cx.render(rsx! {
|
||||
h1 {
|
||||
width: format!("{}px", count),
|
||||
"High-Five counter: {count}"
|
||||
"High-Five counter: {count}",
|
||||
Comp{
|
||||
color: "#083289"
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Props)]
|
||||
struct CompProps {
|
||||
color: &'static str,
|
||||
}
|
||||
|
||||
fn Comp(cx: Scope<CompProps>) -> Element {
|
||||
cx.render(rsx! {
|
||||
h1 {
|
||||
color: cx.props.color,
|
||||
"Hello, from a component!"
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user