Function rui::redux

source ·
pub fn redux<V: View, A: 'static, S: 'static, D: Fn() -> S + 'static, F: Fn(&S) -> V + 'static, R: Fn(&mut S, &A) + 'static + Clone>(
    initial: D,
    reducer: R,
    f: F
) -> impl View
Examples found in repository?
examples/counter_redux.rs (lines 27-33)
26
27
28
29
30
31
32
33
34
fn main() {
    rui(redux(AppState::new, reduce, |state| {
        vstack((
            format!("{}", state.count).padding(Auto),
            button_a("increment", Action::Increment).padding(Auto),
            button_a("decrement", Action::Decrement).padding(Auto),
        ))
    }));
}