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

Gil Goldzweig

10/24/2019, 5:39 AM
Guys, great work on the progress. It's great to see that our feedback is actually being listened to. Quick question. Where is it better to write compose functions? In a class or a file?
c

Cody Engel

10/24/2019, 5:43 AM
It seems like file are the preferred route for things annotated with
Composable
. At least the components I’ve been looking at from Compose seem that way.
Text
,
TextField
,
Flex
, etc all end up as top level functions at least.
s

streetsofboston

10/24/2019, 5:47 AM
Since state that needs to be rendered is passed down as input-parameters to these
@Compose
functions, making them static (top-level) seems like a good idea. No 'accidental' using state from the Activity or other such classes to render your 'Compose'd UI.
1
a

Adam Powell

10/24/2019, 12:54 PM
Composable functions on classes make sense when you're using the class as sort of a place for private hoisted state that the composable uses. We're still playing with some potential recommendations there