docs: more use_ref docs
This commit is contained in:
1 parent
45473ece8c
commit
e7022dfccf
2 files changed
+216
-53
No files matched your search
+9
-5
@@ -6,12 +6,16 @@ fn main() {}
|
||||
fn app(cx: Scope) -> Element {
|
||||
let val = use_ref(&cx, || HashMap::<u32, String>::new());
|
||||
|
||||
// Pull the value out locally
|
||||
let p = val.read();
|
||||
{
|
||||
// Pull the value out locally
|
||||
let p = val.read();
|
||||
|
||||
// to get an &HashMap we have to "reborrow" through the RefCell
|
||||
// Be careful: passing this into children might cause a double borrow of the RefCell and a panic
|
||||
let g = &*p;
|
||||
// to get an &HashMap we have to "reborrow" through the RefCell
|
||||
// Be careful: passing this into children might cause a double borrow of the RefCell and a panic
|
||||
let g = &*p;
|
||||
|
||||
dbg!(g);
|
||||
}
|
||||
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
|
||||
Reference in new issue
Block a user