Make cargo check --all --examples work!
This commit is contained in:
40 files changed
+295
-399
No files matched your search
@@ -53,5 +53,5 @@ fn main() {
|
||||
.set_inner_html(&pre);
|
||||
|
||||
// now rehydrate
|
||||
dioxus_web::launch_with_props(app, (), Config::new().hydrate(true));
|
||||
dioxus_web::launch::launch(app, vec![], Config::new().hydrate(true));
|
||||
}
|
||||
@@ -2,17 +2,16 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus_web::launch(app);
|
||||
dioxus_web::launch::launch(app, vec![], Default::default());
|
||||
}
|
||||
|
||||
fn app() -> Element {
|
||||
let count = use_signal(|| 0);
|
||||
let started = use_signal(|| false);
|
||||
let mut count = use_signal(|| 0);
|
||||
let mut started = use_signal(|| false);
|
||||
|
||||
let start = move || {
|
||||
if !*started.get() {
|
||||
let count = count.clone(); // clone reference rather than value
|
||||
let alert = move || gloo_dialogs::alert(&format!("Your score was {}!", count.read()));
|
||||
let mut start = move || {
|
||||
if !started() {
|
||||
let alert = move || gloo_dialogs::alert(&format!("Your score was {count}!",));
|
||||
gloo_timers::callback::Timeout::new(5_000, alert).forget();
|
||||
}
|
||||
started.set(true); // this cannot be done inside condition or infinite loop
|
||||
@@ -22,10 +21,11 @@ fn app() -> Element {
|
||||
button {
|
||||
onclick: move |_event| {
|
||||
start();
|
||||
*count.write() += 1;
|
||||
count += 1;
|
||||
},
|
||||
if **started {
|
||||
"Current score: {count.read()}"
|
||||
|
||||
if started() {
|
||||
"Current score: {count}"
|
||||
} else {
|
||||
"Start"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user