reducer!() { /* proc-macro */ }Expand description
The reducer! macro for creating order-independent state with dispatch.
Returns (state, dispatch) where dispatch sends actions through
a reducer function to produce new state.
§Examples
ⓘ
let (state, dispatch) = reducer!(cx, AppState::Idle, |state, action| {
match (state, action) {
(_, Action::Reset) => AppState::Idle,
(s, _) => s,
}
});
// Dispatch an action
dispatch(Action::Reset);