fix readme expanded example

This commit is contained in:
Evan Almloff 2023-09-11 16:40:11 -05:00
parent 9d044ee589
commit cbf8a1e158

View file

@ -84,24 +84,22 @@ fn app(cx: Scope) -> Element {
],
};
// The VNode is a reference to the template with the dynamic parts of the rsx
::dioxus::core::VNode {
parent: Default::default(),
key: None,
::dioxus::core::VNode::new(
None,
// The static template this node will use. The template is stored in a Cell so it can be replaced with a new template when hot rsx reloading is enabled
template: std::cell::Cell::new(TEMPLATE),
root_ids: dioxus::core::exports::bumpalo::collections::Vec::new_in(__cx.bump())
.into(),
dynamic_nodes: __cx.bump().alloc([
TEMPLATE,
dioxus::core::exports::bumpalo::collections::Vec::new_in(__cx.bump()),
__cx.bump().alloc([
// The dynamic count text node (dynamic node id 0)
__cx.text_node(format_args!("High-Five counter: {0}", count)),
]),
dynamic_attrs: __cx.bump().alloc([
__cx.bump().alloc([
// The dynamic up high button onclick listener (dynamic attribute id 0)
dioxus_elements::events::onclick(__cx, move |_| count += 1),
// The dynamic down low button onclick listener (dynamic attribute id 1)
dioxus_elements::events::onclick(__cx, move |_| count -= 1),
]),
}
)
},
),
)