Macro freya::prelude::to_owned

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_signal(|| {});

let handle_thing = move |_| {
    to_owned![data, cx.props.prop];
    cx.spawn(async move {
        // do stuff
    });
};