mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 04:33:06 +00:00
24 lines
636 B
Rust
24 lines
636 B
Rust
#![allow(unused, non_upper_case_globals)]
|
|
|
|
use dioxus_core::prelude::*;
|
|
|
|
fn main() {}
|
|
|
|
static Example: FC<()> = |cx| {
|
|
let (name, set_name) = use_state(&cx, || "...?");
|
|
|
|
cx.render(rsx!(
|
|
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>))}
|
|
}
|
|
))
|
|
};
|
|
|
|
pub fn render<'src, 'a, F: for<'b> FnOnce(&'b NodeCtx<'src>) -> VNode<'src> + 'src + 'a, P>(
|
|
cx: &'a Context<'src, P>,
|
|
lazy_nodes: LazyNodes<'src, F>,
|
|
) -> VNode<'src> {
|
|
cx.render(lazy_nodes)
|
|
}
|