2021-02-12 05:29:46 +00:00
|
|
|
#![allow(unused)]
|
|
|
|
//! Example of components in
|
|
|
|
|
2021-05-26 05:40:30 +00:00
|
|
|
use std::{borrow::Borrow, marker::PhantomData};
|
2021-02-12 05:29:46 +00:00
|
|
|
|
|
|
|
use dioxus_core::prelude::*;
|
|
|
|
|
|
|
|
fn main() {}
|
|
|
|
|
2021-06-01 22:33:15 +00:00
|
|
|
static Header: FC<()> = |ctx| {
|
|
|
|
let inner = use_ref(ctx, || 0);
|
2021-02-12 05:29:46 +00:00
|
|
|
|
2021-05-26 05:40:30 +00:00
|
|
|
let handler1 = move || println!("Value is {}", inner.borrow());
|
2021-02-12 05:29:46 +00:00
|
|
|
|
2021-05-26 05:40:30 +00:00
|
|
|
ctx.render(dioxus::prelude::LazyNodes::new(|nodectx| {
|
|
|
|
builder::ElementBuilder::new(nodectx, "div")
|
2021-06-02 15:07:30 +00:00
|
|
|
.child(VNode::Component(nodectx.bump().alloc(VComponent::new(
|
|
|
|
Bottom,
|
|
|
|
(),
|
|
|
|
None,
|
|
|
|
))))
|
2021-02-12 08:07:35 +00:00
|
|
|
.finish()
|
2021-03-23 03:52:54 +00:00
|
|
|
}))
|
2021-02-12 05:29:46 +00:00
|
|
|
};
|
|
|
|
|
2021-06-01 22:33:15 +00:00
|
|
|
static Bottom: FC<()> = |ctx| {
|
2021-03-01 02:21:17 +00:00
|
|
|
ctx.render(html! {
|
2021-02-12 05:29:46 +00:00
|
|
|
<div>
|
|
|
|
<h1> "bruh 1" </h1>
|
|
|
|
<h1> "bruh 2" </h1>
|
|
|
|
</div>
|
|
|
|
})
|
|
|
|
};
|
2021-05-26 05:40:30 +00:00
|
|
|
|
2021-06-01 22:33:15 +00:00
|
|
|
fn Top(ctx: Context<()>) -> VNode {
|
2021-05-26 05:40:30 +00:00
|
|
|
ctx.render(html! {
|
|
|
|
<div>
|
|
|
|
<h1> "bruh 1" </h1>
|
|
|
|
<h1> "bruh 2" </h1>
|
|
|
|
</div>
|
|
|
|
})
|
|
|
|
}
|