https://kotlinlang.org logo
#compose
Title
# compose
c

carbaj0

05/30/2020, 9:51 AM
Hi! launchInComposition this is called only one time due to the remember, but what happens if I want to call it more than one time? For example:
Copy code
var text by state { "empty" }
var result by state { "" }
launchInComposition { result = getData(text) }
FilledTextField(
    value = text,
    onValueChange = { text = it },
    label = { Text("Label") }
)
it makes sense because otherwise, I start a loop in this case, but which would be the best approach?
Copy code
launchInComposition(text) { result = getData(text) }
very similar to useEffect in React, isn't it?
a

Adam Powell

05/30/2020, 1:31 PM
You've got it, yes. Also matches
remember
itself and
onCommit
3 Views