2021-03-09 00:58:20 -05:00
|
|
|
use dioxus_core::{component::Properties, prelude::*};
|
2021-02-07 16:21:38 -05:00
|
|
|
|
2021-02-07 17:38:17 -05:00
|
|
|
fn main() -> Result<(), ()> {
|
2021-03-09 00:58:20 -05:00
|
|
|
let p1 = SomeProps { name: "bob".into() };
|
2021-02-07 16:21:38 -05:00
|
|
|
|
2021-03-10 19:42:31 -05:00
|
|
|
let _vdom = VirtualDom::new_with_props(Example, p1);
|
2021-02-07 17:38:17 -05:00
|
|
|
|
|
|
|
Ok(())
|
2021-02-07 16:21:38 -05:00
|
|
|
}
|
|
|
|
|
2021-03-09 00:58:20 -05:00
|
|
|
#[derive(Debug, PartialEq, Props)]
|
|
|
|
struct SomeProps {
|
2021-02-07 16:21:38 -05:00
|
|
|
name: String,
|
|
|
|
}
|
2021-02-12 00:29:46 -05:00
|
|
|
|
2021-03-09 00:58:20 -05:00
|
|
|
static Example: FC<SomeProps> = |ctx, _props| {
|
2021-02-28 21:21:17 -05:00
|
|
|
ctx.render(html! {
|
2021-02-07 16:21:38 -05:00
|
|
|
<div>
|
2021-02-12 00:29:46 -05:00
|
|
|
<h1> "hello world!" </h1>
|
|
|
|
<h1> "hello world!" </h1>
|
|
|
|
<h1> "hello world!" </h1>
|
|
|
|
<h1> "hello world!" </h1>
|
2021-02-07 16:21:38 -05:00
|
|
|
</div>
|
|
|
|
})
|
|
|
|
};
|
2021-03-09 00:58:20 -05:00
|
|
|
|
|
|
|
// toodo: derive this
|
|
|
|
impl Properties for SomeProps {
|
|
|
|
type Builder = SomePropsBuilder<((),)>;
|
|
|
|
fn builder() -> Self::Builder {
|
|
|
|
SomeProps::builder()
|
|
|
|
}
|
|
|
|
}
|