Is the event lambda necessary? Will it affect performance?
In a Composable, Usually we use function param to handle the event, such as the following onClickHandler: () -> Unit
In the official documentation, using a lambda to call this onClickHandler function.
@Composable
fun FilledButtonExample(onClickHandler: () -> Unit) {
Button(onClick = { onClickHandler() }) {
Text("Filled")
}
}
Is it better if we assign the onClickHandler function directly to the onClick variable? such as Button(onClick = onClickHandler )
@Composable
fun...