docs: remove use_ref example
This commit is contained in:
1 parent
e7022dfccf
commit
98076c52e8
1 file changed
-25
@@ -1,25 +0,0 @@
|
|||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
use dioxus::prelude::*;
|
|
||||||
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();
|
|
||||||
|
|
||||||
// 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 {
|
|
||||||
"hi"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user