Explorar o código

Fix closure signature for use_ref example in interactivity docs

The example showed the closure accepting a single argument, but it accepts
none.
Dave Rolsky %!s(int64=3) %!d(string=hai) anos
pai
achega
7c2d911fbf
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      docs/guide/src/interactivity/hooks.md

+ 1 - 1
docs/guide/src/interactivity/hooks.md

@@ -140,7 +140,7 @@ fn Child(cx: Scope, name: String) -> Element {
 
 // ✅ Or, use a hashmap with use_ref
 ```rust
-let ages = use_ref(&cx, |_| HashMap::new());
+let ages = use_ref(&cx, || HashMap::new());
 
 names.iter().map(|name| {
     let age = ages.get(name).unwrap();