Slide 10
Slide 10 text
その場合のStateの変更箇所のコード
class SampleReducer {
fun reduce(action: Action, currentState: SampleState): SampleState =
when (action) {
is ShowDataAction -> {
if (action.result.isSuccess) {
currentState.copy(entity = action.result.entity, isLoading = false)
} else {
currentState.copy(error = action.result.error, isLoading = false)
}
}
is LoadData -> currentState.copy(isLoading = true, entity = null, error = null)
else -> currentState
}
}