0

I started learning Compose just recently. So far I had no difficulty implementing different Composables and controlling them around, but there are some terminologies that I am struggling to understand !

One of them is remember { } which returns the same type as mutableState(Both are snapshots). Here's an example:

        val myItems = mutableStateListOf<Int>()

        //then I call the composable here for example, and pass the items as a param:
        DropdownMenuCustomizedByMe(... items = myItems) { ... }

My Composable gets recomposed everytime the above variable changes, so that's the functionality I wanted, I am not sure what exactly is the purpose behind rememberif the latter does the job. I tried reading docs and people's explanations around stackoverflow but I really couldn't come to a practical conclusion as to why I'd use it.

yuroyami
  • 814
  • 6
  • 24

0 Answers0