Skip to content

Instantly share code, notes, and snippets.

@Laimiux
Last active April 3, 2018 03:02
Show Gist options
  • Save Laimiux/927d06943133ad50fcf387ca9d0b84f3 to your computer and use it in GitHub Desktop.
Save Laimiux/927d06943133ad50fcf387ca9d0b84f3 to your computer and use it in GitHub Desktop.
fun reduce(event: TextChangedEvent, state: CommentFormData): CommentFormData {
// Let's check comment validity
val isValid = event.enteredText.length > 5
// Update the current state with the changes
return state.copy(comment = event.enteredText, isCommentValid = isValid)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment