Skip to content

Commit 4ab710c

Browse files
authored
Update tutorial to use use_effect_deps instead of use_effect (#2090)
1 parent e503c9a commit 4ab710c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

website/docs/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ fn app() -> Html {
480480
+ let videos = use_state(|| vec![]);
481481
+ {
482482
+ let videos = videos.clone();
483-
+ use_effect(move || {
483+
+ use_effect_with_deps(move |_| {
484484
+ let videos = videos.clone();
485485
+ wasm_bindgen_futures::spawn_local(async move {
486486
+ let fetched_videos: Vec<Video> = Request::get("https://yew.rs/tutorial/data.json")
@@ -493,7 +493,7 @@ fn app() -> Html {
493493
+ videos.set(fetched_videos);
494494
+ });
495495
+ || ()
496-
+ });
496+
+ }, ());
497497
+ }
498498

499499
// ...

0 commit comments

Comments
 (0)