_shtomar
11/12/2021, 11:29 PMnglauber
11/13/2021, 12:42 AM@Composable
fun Foo() {
// ...
LaunchedEffect(Unit) {
// This code will run just on
// the first composition
}
}
However, if you remove Foo from the composition, it will be called again…
For instance:
if (someFlag) {
Foo()
} else {
Bar()
}
every time you set someFlag to true, the code inside the LaunchedEffect will be executed.Adam Powell
11/13/2021, 12:43 AM_shtomar
11/13/2021, 12:54 AM_shtomar
11/13/2021, 12:56 AMK Merle
11/13/2021, 5:17 AM@Composable
fun Foo() {
// ...
LaunchedEffect(title) {
// This code will run just on
// the first composition
}
}