what is the best way to pre populate a textfield i...
# compose
a
what is the best way to pre populate a textfield in compose but remember the following state?
a
You mean like this
Copy code
var text by remember { mutableStateOf("initial") }
  TextField(text, onValueChange { text = it })
m
what Allan said OR. composables should be function of state. so you can emit initial state with data you want to pre populate with
a
wouldn't normally use TextFieldValue for this?
p
both are fine.
TextFieldValue
has some additional features, like text selection. Just use
String
if that works for you.
m
use what meets your requirements
a
Okay, thanks!