dioxus/packages/core/examples/fc.rs

37 lines
686 B
Rust
Raw Normal View History

2021-03-09 19:45:52 +00:00
use dioxus_core::component::fc_to_builder;
2021-03-08 02:28:20 +00:00
use dioxus_core::prelude::*;
use dioxus_core_macro::fc;
use std::marker::PhantomData;
2021-03-09 19:45:52 +00:00
static BLAH: FC<()> = |ctx, props| {
let g = "asd".to_string();
2021-03-08 02:28:20 +00:00
ctx.render(rsx! {
div {
SomeComponent {
2021-03-09 19:45:52 +00:00
some_field: g
2021-03-08 02:28:20 +00:00
}
}
})
2021-03-09 19:45:52 +00:00
};
2021-03-08 02:28:20 +00:00
2021-03-09 19:45:52 +00:00
#[derive(PartialEq, Props)]
pub struct ExampleProps {
some_field: String,
2021-03-08 02:28:20 +00:00
}
2021-03-09 19:45:52 +00:00
static SomeComponent: FC<ExampleProps> = |ctx, props| {
ctx.render(rsx! {
div { }
})
};
2021-03-08 02:28:20 +00:00
fn main() {}
2021-03-09 19:45:52 +00:00
impl Properties for ExampleProps {
type Builder = ExamplePropsBuilder<((),)>;
fn builder() -> Self::Builder {
ExampleProps::builder()
}
}