pub fn create_rw_signal<T>(value: T) -> RwSignal<T>
Expand description

Creates a reactive signal with the getter and setter unified in one value. You may prefer this style, or it may be easier to pass around in a context or as a function argument.

let count = create_rw_signal(0);

// ✅ set the value
count.set(1);
assert_eq!(count.get(), 1);

// ❌ you can call the getter within the setter
// count.set(count.get() + 1);

// ✅ however, it's more efficient to use .update() and mutate the value in place
count.update(|count: &mut i32| *count += 1);
assert_eq!(count.get(), 2);