What does Jetpack Compose remember actually do, how does it work under the hood?

remember – allows you to remember state from previous recompose invocation and just this.
So, if you for instance randomize color at initial run. The randomized color is going to be calculated only once and later reused whenever re-compose is necessary.

And hence,

remember = store the value just in case recompose is called.

Now, the second important thing is knowing when reCompose should actually be triggered and there the mutable states come to help.

mutablestate = store the value and in case I update value trigger, recompose for all elements using this data.

Leave a Comment