fix: docs

This commit is contained in:
YuKun Liu 2022-03-28 13:11:33 +08:00 committed by GitHub
parent fe3577faaf
commit 8e1e06d8c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,9 +60,9 @@ The best use case of `use_ref` is to manage "complex" data local to your compone
```rust
let val = use_state(&cx, || vec![1, 3, 3, 7]);
let val = use_state(&cx, || (0..10000).collect::<Vec<_>x>());
let val = use_state(&cx, || Configuration {
let val = use_ref(&cx, || vec![1, 3, 3, 7]);
let val = use_ref(&cx, || (0..10000).collect::<Vec<_>x>());
let val = use_ref(&cx, || Configuration {
a: "asdasd",
// .. more complex fields
});
@ -82,6 +82,7 @@ fn app(cx: Scope) -> Element {
})
}
#[inline_props]
fn Child(cx: Scope, val: UseRef<i32>) -> Element {
// ...
}