1 of 8

State and Jetpack Compose

The Mystery

By Moro

2 of 8

Let’s learn about State in Compose

I want to eat pizza too.

Okay Scooby! Let’s use pizza in the example…

3 of 8

Imagine a screen when you will order a pizza!

Velma, I’m sad this app is so poor. Few flavors : (

4 of 8

This component doesn’t have state, so it is a Stateless Widget

5 of 8

The Screen should pass the current value and a callback to change the state. So we have this component for each flavor

Current value to be drawn

Callback to signaling to the screen “the value was changed, we need a recomposition”

6 of 8

This component has a state, so it is a Statefull Widget

7 of 8

This represents the user selection

This is coming from the server. Shaggy, and Scooby, please ask the Pizzeria to add more flavors!

8 of 8

By Moro