wip: major cleanups to scheduler
This commit is contained in:
1 parent
d96276a715
commit
2933e4bc11
36 files changed
+641
-663
No files matched your search
@@ -102,12 +102,9 @@ pub static Example: FC<()> = |(cx, props)| {
|
||||
}}
|
||||
|
||||
// Matching
|
||||
// Matching will throw a Rust error about "no two closures are the same type"
|
||||
// To fix this, call "render" method or use the "in" syntax to produce VNodes.
|
||||
// There's nothing we can do about it, sorry :/ (unless you want *really* unhygienic macros)
|
||||
{match true {
|
||||
true => rsx!(cx, h1 {"Top text"}),
|
||||
false => cx.render(rsx!( h1 {"Bottom text"}))
|
||||
true => rsx!( h1 {"Top text"}),
|
||||
false => rsx!( h1 {"Bottom text"})
|
||||
}}
|
||||
|
||||
// Conditional rendering
|
||||
@@ -174,10 +171,17 @@ pub static Example: FC<()> = |(cx, props)| {
|
||||
|
||||
// Can take children too!
|
||||
Taller { a: "asd", div {"hello world!"} }
|
||||
|
||||
// helper functions
|
||||
{helper(cx, "hello world!")}
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
fn helper(cx: Context, text: &str) -> Element {
|
||||
rsx!(cx, p { "{text}" })
|
||||
}
|
||||
|
||||
mod baller {
|
||||
use super::*;
|
||||
#[derive(Props, PartialEq)]
|
||||
|
||||
Reference in new issue
Block a user