fn apply_events(state: &AppState, events: &[Event]) -> Result<(), String>
Writes each event the reducer emitted to the store, stopping at the first failure.