# compose

Vladimir Tagakov

10/27/2023, 7:11 PM
Hi folks! Can you help me to find a thing from google’s docs for compose? I am pretty sure I saw that google recommends to pass multiple callbacks to a composable function instead of using a single one with an action passed as a parameter. In other words they suggest to write:
Copy code
fun MyComposable(somethingHappened: () -> Unit, otherHappened: () -> Unit)
instead of
Copy code
fun MyComposable(onAction: (ActionSealedClass) -> Unit)
Can’t find a proof for that in the docs or guidelines tho 😞 Can anyone help?

Zach Klippenstein (he/him) [MOD]

10/27/2023, 7:12 PM
I don’t think i’ve ever seen/heard this recommendation


10/27/2023, 7:38 PM
im guessing its in the context of state and instead of passing
as parameters, pairing it with callback and value as separate params:
Copy code
fun MyComposable(value: ActionSealedClass,onUpdate: (ActionSealedClass) -> Unit)

Vladimir Tagakov

10/27/2023, 7:40 PM
Nope, that’s not the case 😞 Alright, I can’t find anything related, so I think it is either phantom memory or a change in the docs. Thank you, folks!
Nothing clear there.

Vladimir Tagakov

10/27/2023, 7:41 PM
Yep, they don’t mention anything like that
And also for some reason I can’t see the history of those files

Arkadii Ivanov

10/27/2023, 8:50 PM
There is "History" button at the bottom of the page. Does it help?

Vladimir Tagakov

10/27/2023, 8:52 PM
=\ I was lookig here: And didn’t notice that Yuri’s link is to
instead. I’ll take a look, thank you, but I doubt I’ll be able to find it still :)
👍 1
It didn’t help 😞
😑 1


10/27/2023, 9:32 PM
I swear I have seen the same advice somewhere too. Not sure if it showed up in a code workshop or what. But it did say to favor multiple lambdas over sealed classes and enums. I think the reasoning has to do with it being easier to refactor and implement thanks to it's simplicity.