Function maple_core::reactive::create_signal[][src]

pub fn create_signal<T: 'static>(
    value: T
) -> (StateHandle<T>, SetStateHandle<T>)

Creates a new signal. The function will return a pair of getter/setters to modify the signal and update corresponding dependencies.

Example

use maple_core::prelude::*;

let (state, set_state) = create_signal(0);
assert_eq!(*state(), 0);

set_state(1);
assert_eq!(*state(), 1);