I copy a `mutableStateListOf`<https://developer.an...
# compose
d
I copy a `mutableStateListOf` example from docs without any changes, but it doesn't seem to work. AFAIU it should add new names, but the list on the screen stays empty. If I change it to
var names = remember { mutableStateListOf<String>() }
it starts to work. Is it a mistake in docs or am I doing/expecting something wrong?
Code from the link:
Copy code
@Composable
fun Names() {
    var name by remember { mutableStateOf("user") }
    val names = mutableStateListOf<String>()

    Column {
        Row {
            BasicTextField(
                value = name,
                onValueChange = { name = it }
            )
            Button(onClick = { names.add(name) }) {
                Text("Add")
            }
        }
        Text("Added names:")
        Column {
            for (addedName in names) {
                Text(addedName)
            }
        }
    }
}
j
🤦
cc @nickbutcher
n
d
I did not. Nick, thank you for fixing it! And Jim thanks for your help too :)