2021-02-08 21:57:34 +00:00
|
|
|
#![allow(unused, non_upper_case_globals)]
|
|
|
|
|
|
|
|
use dioxus_core::prelude::*;
|
|
|
|
|
2021-06-24 15:09:38 +00:00
|
|
|
fn main() {}
|
2021-02-08 21:57:34 +00:00
|
|
|
|
2021-06-26 01:15:33 +00:00
|
|
|
static Example: FC<()> = |cx| {
|
|
|
|
let (name, set_name) = use_state(&cx, || "...?");
|
2021-02-12 05:29:46 +00:00
|
|
|
|
2021-06-26 01:15:33 +00:00
|
|
|
cx.render(rsx!(
|
2021-06-01 22:33:15 +00:00
|
|
|
div {
|
|
|
|
h1 { "Hello, {name}" }
|
|
|
|
// look ma - we can rsx! and html! together
|
|
|
|
{["jack", "jill"].iter().map(|f| html!(<button onclick={move |_| set_name(f)}> "{f}" </button>))}
|
|
|
|
}
|
|
|
|
))
|
2021-02-08 21:57:34 +00:00
|
|
|
};
|
2021-06-01 22:33:15 +00:00
|
|
|
|
|
|
|
pub fn render<'src, 'a, F: for<'b> FnOnce(&'b NodeCtx<'src>) -> VNode<'src> + 'src + 'a, P>(
|
2021-06-26 01:15:33 +00:00
|
|
|
cx: &'a Context<'src, P>,
|
2021-06-01 22:33:15 +00:00
|
|
|
lazy_nodes: LazyNodes<'src, F>,
|
|
|
|
) -> VNode<'src> {
|
2021-06-26 01:15:33 +00:00
|
|
|
cx.render(lazy_nodes)
|
2021-06-01 22:33:15 +00:00
|
|
|
}
|