https://kotlinlang.org logo
k

Ketan

09/02/2020, 12:48 PM
Is it possible to add condition clause [lets say
buildWhen (previousState, currentState)
] while re-composing the ui widget so if data is not changed for particular child ui widget it won’t be re-composed? Is there any way to achieve this?
z

Zach Klippenstein (he/him) [MOD]

09/02/2020, 12:52 PM
If the data hasn’t changed for a composable function, it shouldn’t be recomposed, that’s the default behavior.
🆒 1
Although how “change” is defined has some subtleties. Your data should be
@Stable
, and comply with the associated contract
k

Ketan

09/02/2020, 1:02 PM
Thanks a lot @Zach Klippenstein (he/him) [MOD]