Feat: push new component API and context API

This commit is contained in:
Jonathan Kelley committed 2021-02-11 23:03:01 -05:00
1 parent 8329268d39
commit 125f5426a4
14 files changed
+432 -264

No files matched your search

+12 -7
View File
@@ -43,20 +43,25 @@ mod tests {
todo!()
}
fn test_component(ctx: Context<()>) -> VNode {
ctx.view(html! {<div> </div> })
}
static TestComponent: FC<()> = |ctx, props| {
//
ctx.view(html! {
<div>
</div>
})
};
fn test_component2(ctx: Context<()>) -> VNode {
static TestComponent2: FC<()> = |ctx, props| {
//
ctx.view(|bump: &Bump| VNode::text("blah"))
}
};
#[test]
fn ensure_types_work() {
let bump = Bump::new();
// Happiness! The VNodes are now allocated onto the bump vdom
let _ = test_static_fn(&bump, test_component);
let _ = test_static_fn(&bump, test_component2);
let _ = test_static_fn(&bump, TestComponent);
let _ = test_static_fn(&bump, TestComponent2);
}
}