Imagine a bakery with multiple kitchens. You have a main recipe, the parent composable, for delicious cookies. This recipe calls for steps like mixing dry ingredients, creaming butter and sugar, and baking. The steps are the child composables.
Instead of each step having a separate stock of ingredients (state), what if you could keep a central pantry for the entire bakery, the Compose hierarchy? The central pantry would be located at a higher level in the bakery and accessible to all steps that need the ingredients.
This is state hoisting. In this lesson, you’ll learn about state hoisting and its purpose in Jetpack Compose. You’ll also learn about the best practices for hoisting state and when not to hoist state.
See forum comments
This content was released on Sep 10 2024. The official support period is 6-months
from this date.
Learn about state hoisting and the difference between stateful and stateless composables
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
Previous: Quiz: Remember State Variables
Next: Instruction 1
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.