RememberTextFieldStateOnTextChangedSample
@Sampled
@Composable
fun RememberTextFieldStateOnTextChangedSample(onNameChanged: (String) -> Unit) {
// The composable owns the state. onNameChanged is read again on every recomposition, so the
// latest lambda is always the one that runs.
val state = rememberTextFieldState(onTextChanged = { onNameChanged(it.toString()) })
BasicTextField(state)
}