Created
April 23, 2023 08:49
-
-
Save thearchetypee/57c3ddda3f1b3b9ec72b1e2b31b5456f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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