I don't know what is it
in Textfield's onValueChange using Jetpack compose.
val usernameState = rememberSaveable { mutableStateOf(TextFieldValue())}
TextField(
value = usernameState.value,
onValueChange = {usernameState.value = it}
)
Is it
the argument in lambda function?
I think every time the textfield's value changes, the lambda function is called.
So if we don't use the omission using it
, what do we write in the lambda function.
Please teach me. Thank you.
In kotlin you can omit the argument of any lambda, after which you can refer to the argument with it
onValueChange = {usernameState.value = it}
is identical to
onValueChange = {value -> usernameState.value = value}
This of course only works for lambdas with a single argument.