2021-07-18 16:39:32 +00:00
|
|
|
use dioxus_core::prelude::*;
|
2021-10-30 22:23:28 +00:00
|
|
|
use dioxus_core_macro::format_args_f;
|
|
|
|
use dioxus_core_macro::rsx;
|
|
|
|
use dioxus_html as dioxus_elements;
|
2021-03-23 03:52:54 +00:00
|
|
|
|
2021-09-22 05:25:28 +00:00
|
|
|
fn main() {
|
|
|
|
let mut dom = VirtualDom::new(EXAMPLE);
|
|
|
|
dom.rebuild();
|
|
|
|
println!("{}", dom);
|
|
|
|
}
|
2021-07-29 01:46:53 +00:00
|
|
|
|
2021-10-16 21:37:28 +00:00
|
|
|
pub static EXAMPLE: FC<()> = |(cx, _)| {
|
2021-10-30 22:23:28 +00:00
|
|
|
let list = (0..10).map(|_f| {
|
|
|
|
rsx! {
|
|
|
|
"{_f}"
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// let list = (0..10).map(|_f| Some(Box::new(move |_f| todo!())));
|
2021-07-11 23:31:07 +00:00
|
|
|
|
2021-10-30 22:23:28 +00:00
|
|
|
cx.render(Some(Box::new(move |cx| {
|
2021-07-18 16:39:32 +00:00
|
|
|
cx.raw_element(
|
|
|
|
"div",
|
|
|
|
None,
|
2021-08-24 16:43:46 +00:00
|
|
|
[],
|
|
|
|
[],
|
|
|
|
[
|
2021-07-18 16:39:32 +00:00
|
|
|
cx.text(format_args!("hello")),
|
|
|
|
cx.text(format_args!("hello")),
|
|
|
|
cx.fragment_from_iter(list),
|
2021-08-24 16:43:46 +00:00
|
|
|
],
|
2021-07-18 16:39:32 +00:00
|
|
|
None,
|
|
|
|
)
|
2021-10-30 22:23:28 +00:00
|
|
|
})))
|
2021-07-18 16:39:32 +00:00
|
|
|
};
|