// Don't do this
@Composable
private fun MyComposable(modifier: Modifier = Modifier) {
Column(modifier) {
Text(modifier.clickable(), ...)
Image(modifier.size(), ...)
Button(modifier, ...)
}
}
// Do this
@Composable
private fun MyComposable(modifier: Modifier = Modifier) {
Column(modifier) {
Text(Modifier.clickable(), ...)
Image(Modifier.size(), ...)
Button(Modifier, ...)
}
}
// Don't do this
@Composable
fun MyComposable(
viewModel: MyViewModel = viewModel()
) {
OtherComposable(viewModel)
}
// Do this
@Composable
fun MyComposable(
viewModel: MyViewModel = viewModel()
) {
val uiState = viewModel.uiState.collectAsState()
OtherComposable(
data = uiState.data,
onSaveButtonClicked = viewModel::onSaveButtonClicked
)
}
//Don't do this
Column {
MyComposable()
}
//Do this
@Composable
private fun MyComposable() {
Text(...)
Image(...)
Button(...)
}
// Or do this
@Composable
private fun ColumnScope.MyComposable() {
Text(...)
Image(...)
Button(...)
}
์ปดํฌ์ฆ ์ด๋ ต๋๋ฐ ใ ใ