fn counter_reducer(state: &State, action: Action) -> State {
    match action {
        Action::Increment => State {
            counter: state.counter + 1,
        },
        Action::Decrement => State {
            counter: state.counter - 1,
        },
    }
}
// Here comes the reducer. It gets the current state plus an action to perform and returns a new state.
Here comes the reducer. It gets the current state plus an action to perform and returns a new state.
Here comes the reducer . It gets the current state plus an action to perform and returns a new state .
fn counter_reducer(state: &State, action: Action) -> State {
    match action {
        Action::Increment => State {
            counter: state.counter + 1,
        },
        Action::Decrement => State {
            counter: state.counter - 1,
        },
    }
}
fn counter_reducer ( state : & State , action : Action ) -> State { match action { Action :: Increment => State { counter : state . counter + 1 , } , Action :: Decrement => State { counter : state . counter - 1 , } , } }
Here comes the reducer.
Here comes the reducer .
state
&State
action
Action
state
&State
action
Action