0PricingLogin
Jetpack Compose Academy · Lesson

Stateful vs Stateless Composables

Separate logic from presentation.

Two Kinds of Composables

Every Composable is either stateful (it holds its own data) or stateless (it just renders what you pass in). Knowing which is which shapes your whole app.

What Stateful Means

A stateful Composable remembers something across recompositions, usually with remember. It owns and changes its own data.

fun Counter() {
  var count by remember { mutableStateOf(0) }
  Button(onClick = { count++ }) { Text("Count: " + count) }
}

All lessons in this course

  1. Stateful vs Stateless Composables
  2. Hoist State with value & onValueChange
  3. Single Source of Truth
  4. Compose State Slots & Content Lambdas
← Back to Jetpack Compose Academy