https://kotlinlang.org logo
#compose
Title
# compose
s

ste

02/21/2022, 6:00 PM
Hi all, I was wondering what's the proper way to handle composables which may have different components inside and may have a slightly different behavior - it is better to differentiate them by their name (e.g.
PrimaryButton
,
PrimaryIconButton
) with more LOC as side effect, or by taking multiple parameters (
PrimaryButton(icon: Int?)
) with more control flow structures and overall complexity as a side effect?
a

Adam Powell

02/21/2022, 6:26 PM
would it ever make sense for the same instance of the composable to change that behavior in place when it recomposes with a different parameter? If yes, prefer those parameters. If no, prefer separate composables.
s

ste

02/21/2022, 6:41 PM
Thanks!
👍 1