Skip to content

Instantly share code, notes, and snippets.

@thearchetypee
Last active April 28, 2023 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thearchetypee/6733dabbe30634dadde2f8115109b398 to your computer and use it in GitHub Desktop.
Save thearchetypee/6733dabbe30634dadde2f8115109b398 to your computer and use it in GitHub Desktop.
@Composable
fun ParentComponent() {
setContent {
ComposeTheme {
// A surface container using the 'background' color from the theme
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colors.background) {
var dynamicData by remember {
mutableStateOf("")
}
LaunchedEffect(Unit) {
delay(3000L)
dynamicData = "New Text"
}
MyComponent(title = dynamicData)
}
}
}
}
@Composable
fun MyComponent(title: String) {
var data by remember { mutableStateOf("") }
val updatedData by rememberUpdatedState(title)
LaunchedEffect(Unit) {
delay(5000L)
data = updatedData
}
Text(text = data)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment