5 concepts · 15 practice questions
Both keep logic out of the UI. MVI adds discipline: the screen has one immutable state object, user actions arrive as intents, and a pure reducer turns the old state and an intent into the new state. Side effects such as network calls happen outside the reducer.
data class CartState(
val items: List<Line> = emptyList(),
val loading: Boolean = false,
val error: String? = null,
)
sealed interface CartIntent {
data class Remove(val id: String) : CartIntent
data object Retry : CartIntent
}
Sign in to read the rest and take the 15-question test.
Sign in to continue