Function rui::state

source · []
pub fn state<S: 'static, V: View, D: Fn() -> S + 'static, F: Fn(State<S>, &mut Context) -> V + 'static>(
    initial: D,
    f: F
) -> impl View
Expand description

State allows you to associate some state with a view. This is what you’ll use for a data model, as well as per-view state. Your state should be efficiently clonable. Use Rc as necessary.

initial is the initial value for your state.

f callback which is passed a State<S>