Introduction

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

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
Download course materials from Github
Previous: Quiz: Remember State Variables Next: Instruction 1