use_state_with_updater

Function use_state_with_updater 

Source
pub fn use_state_with_updater<T: Clone + 'static>(
    initial_value: T,
) -> (T, impl Fn(Box<dyn FnOnce(&mut T)>), impl Fn(T))
Expand description

Alternative useState hook that returns (value, updater, setter) where:

  • updater: takes a function that modifies the current value
  • setter: takes a new value directly