Skip to content

Instantly share code, notes, and snippets.

@CesarValiente
Created April 21, 2018 11:04
Show Gist options
  • Save CesarValiente/4d5ce35b46e2453cc12125dbb2d63730 to your computer and use it in GitHub Desktop.
Save CesarValiente/4d5ce35b46e2453cc12125dbb2d63730 to your computer and use it in GitHub Desktop.
private fun reduce(action: Action, currentState: State): State {
val newState = when (action) {
is CreationAction -> CreationReducer.reduce(action, currentState)
is UpdateAction -> UpdateReducer.reduce(action, currentState)
is ReadAction -> ReadReducer.reduce(action, currentState)
is DeleteAction -> DeleteReducer.reduce(action, currentState)
is NavigationAction -> NavigationReducer.reduce(action, currentState)
}
return newState
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment