Module 05 Β· State & Data Flow β Lesson 2 of 4 Β· ~12 min
State Hoisting
State down, events up
Text("30 min walk") only displays state. A text field is different: it must show the current value AND report back every character the user types. Compose's pattern for that is called state hoisting: a composable doesn't own its own state β it takes the current value as a parameter, and reports changes back up through a callback like onValueChange. The caller decides where the state actually lives.
This is the direct equivalent of SwiftUI's @Binding: instead of a two-way connection object, Compose just passes a plain value down and a lambda up. Same idea, different mechanics β no special property wrapper needed.