marc2332 2 years ago
parent
commit
bf0247a7dc
1 changed files with 7 additions and 4 deletions
  1. 7 4
      docs/guide/src/en/async/use_effect.md

+ 7 - 4
docs/guide/src/en/async/use_effect.md

@@ -2,11 +2,14 @@
 
 [`use_effect`](https://docs.rs/dioxus-hooks/latest/dioxus_hooks/fn.use_effect.html) provides a future that executes after the hooks have been applied.
 
-Whenever the hooks dependencies change, the future will be re-evaluated. This is useful to syncrhonize with external events.
+Whenever the hooks [dependencies](#dependencies) change, the future will be re-evaluated. This is useful to syncrhonize with external events.
 
-If a future is pending when the dependencies change, the previous future will be allowed to continue
 
-> The `dependencies` is tuple of references to values that are `PartialEq + Clone`.
+## Dependencies
+
+You might want to call `use_effect` only when some value changes. For example, you might want to fetch a user's data only when the user id changes. You can provide a tuple of "dependencies" to the hook. It will automatically re-run the future when any of those dependencies change.
+
+Example:
 
 ```rust, no_run
 #[inline_props]
@@ -29,4 +32,4 @@ fn app(cx: Scope) -> Element {
         Profile { id: "dioxusLabs" }
     )
 }
-```
+```