From 39bce476aedc99f431114e667aa430bd0938d605 Mon Sep 17 00:00:00 2001 From: marc2332 Date: Thu, 13 Jul 2023 19:06:43 +0200 Subject: [PATCH] tweaks --- docs/guide/src/en/async/use_effect.md | 2 +- examples/test.rs | 63 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 examples/test.rs diff --git a/docs/guide/src/en/async/use_effect.md b/docs/guide/src/en/async/use_effect.md index f509921fc..9dc5a8739 100644 --- a/docs/guide/src/en/async/use_effect.md +++ b/docs/guide/src/en/async/use_effect.md @@ -1,6 +1,6 @@ # UseEffect -[`use_effect`](https://docs.rs/dioxus-hooks/latest/dioxus_hooks/fn.use_effect.html) let's you run a callback that returns a future, only it's [dependencies](#dependencies) change. This is useful to syncrhonize with external events. +[`use_effect`](https://docs.rs/dioxus-hooks/latest/dioxus_hooks/fn.use_effect.html) lets you run a callback that returns a future, which will be re-run when it's [dependencies](#dependencies) change. This is useful to syncrhonize with external events. ## Dependencies diff --git a/examples/test.rs b/examples/test.rs new file mode 100644 index 000000000..546934481 --- /dev/null +++ b/examples/test.rs @@ -0,0 +1,63 @@ +use dioxus::prelude::*; +use dioxus_router::*; + +fn main() { + // init debug tool for WebAssembly + wasm_logger::init(wasm_logger::Config::default()); + console_error_panic_hook::set_once(); + + dioxus_web::launch(app); +} + +fn Works1(cx: Scope) -> Element { + render!( + p { + "this is 1" + } + a { + href: "#section", + "section" + } + Link { + to: "/2", + p { + "go to 2" + } + } + p { + "{\"AAAA\n\".repeat(999)}" + } + h2 { + id: "section", + "section" + } + ) +} + +fn Works2(cx: Scope) -> Element { + render!( + p { + "this is 2" + Link { + to: "/", + p { + "go to 1" + } + } + ) +} + +fn app(cx: Scope) -> Element { + cx.render(rsx! ( + Router { + Route { + to: "/", + Works1 {} + } + Route { + to: "/2", + Works2 {} + } + } + )) +} \ No newline at end of file