Skip to content

Instantly share code, notes, and snippets.

@thearchetypee
Created April 23, 2023 08:49
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/57c3ddda3f1b3b9ec72b1e2b31b5456f to your computer and use it in GitHub Desktop.
Save thearchetypee/57c3ddda3f1b3b9ec72b1e2b31b5456f to your computer and use it in GitHub Desktop.
@Composable
fun MyComponent() {
val coroutineScope = rememberCoroutineScope()
val data = remember { mutableStateOf("") }
Button(onClick = {
coroutineScope.launch {
// Simulate network call
delay(2000)
data.value = "Data loaded"
}
}) {
Text("Load data")
}
Text(text = data.value)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment