Feat: view -> render
This commit is contained in:
1 parent
10a236fc65
commit
c8bb392cad
24 files changed
+204
-48
No files matched your search
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user