Created
October 18, 2022 04:35
-
-
Save ch8n/17ede4f49e0c6090f532be7bde8888d2 to your computer and use it in GitHub Desktop.
Equivalent code
This file contains hidden or 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 Foo() { | |
val countState = remember { mutableStateOf(0) } | |
Button(onClick = { | |
val count = countState.value //π count is 0 | |
val setCount = { lastestCount: Int -> | |
countState.value = lastestCount | |
} | |
setCount(count+1) //π 0 + 1 | |
setCount(count+1) //π 0 + 1 | |
}) { | |
Text(text = "Increment by 2") | |
}// button end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment