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

Mehdi Haghgoo

11/09/2021, 12:53 PM
When is it generally OK to use capital variable names? For example, is it fine to use
Copy code
LocalInfo.current.bottomBarItems
as part of my CompositionLocal or should it be BottomBarItems?
b

Big Chungus

11/09/2021, 12:59 PM
Variable names should always be lowerCamelCase. Compose-specific convention is only to use UpperCamelCase for @Composable functions that produce UI. e.g.:
Copy code
@Composable
fun MyButton {
  Button(...)
}

// BUT

@Composable
fun <T> rememberMutableStateOf(default: T): MutableState<T> = remember{mutableStateOf(default)}
2
9 Views