pub fn create_signal<T>(cx: Scope<'_>, value: T) -> &Signal<T>
Expand description

Create a new Signal under the current Scope. The created signal lasts as long as the scope and cannot be used outside of the scope.

Signal lifetime

The lifetime of the returned signal is the same as the Scope. As such, the signal cannot escape the Scope.

let mut outer = None;
create_scope_immediate(|cx| {
    let signal = create_signal(cx, 0);
    outer = Some(signal);
});