feat: re-unify set_state
This commit is contained in:
1 parent
3928856a9b
commit
6c3f5195f4
16 files changed
+199
-136
No files matched your search
@@ -5,13 +5,15 @@ fn main() {
|
||||
}
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let (disabled, set_disabled) = use_state(&cx, || false);
|
||||
let disabled = use_state(&cx, || false);
|
||||
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
button {
|
||||
onclick: move |_| set_disabled(!disabled),
|
||||
"click to " [if *disabled {"enable"} else {"disable"} ] " the lower button"
|
||||
onclick: move |_| disabled.set(!disabled),
|
||||
"click to "
|
||||
[if disabled == true {"enable"} else {"disable"}]
|
||||
" the lower button"
|
||||
}
|
||||
|
||||
button {
|
||||
|
||||
Reference in new issue
Block a user