Feat: view -> render

This commit is contained in:
Jonathan Kelley committed 2021-02-28 21:21:17 -05:00
1 parent 10a236fc65
commit c8bb392cad
24 files changed
+204 -48

No files matched your search

+12 -1
View File
@@ -14,7 +14,18 @@ Dioxus is a portable, performant, and ergonomic framework for building cross-pla
static Example: FC<()> = |ctx| {
let (value, set_value) = use_state(&ctx, || "...?");
ctx.view(html! {
// custom (more powerful) syntax
ctx.render(html! {
div {
h1 { "Hello, {value}" }
button { "?", onclick: move |_| set_value("world!") }
button { "?", onclick: move |_| set_value("Dioxus 🎉") }
}
})
// Classic syntax
// no more updates, frozen
ctx.render(html!{
<div>
<h1> "Hello, {value}" </h1>
<button onclick={move |_| set_value("world!")}> "?" </button>