Macro dioxus_hooks::to_owned
source · macro_rules! to_owned { ($es:ident $(, $($rest:tt)*)?) => { ... }; ($($deref:ident).* $(, $($rest:tt)*)?) => { ... }; ($($deref:ident)* @ $head:ident $( . $tail:ident)+ $(, $($rest:tt)*)?) => { ... }; ($($deref:ident)* @ $last:ident $(, $($rest:tt)*)? ) => { ... }; }
Expand description
A helper macro for using hooks and properties in async environments.
Usage
let (data) = use_ref(cx, || {});
let handle_thing = move |_| {
to_owned![data, cx.props.prop];
cx.spawn(async move {
// do stuff
});
};