Skip to content

Instantly share code, notes, and snippets.

@Skyyo
Created October 2, 2022 15:25
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 Skyyo/de44d33f08bc37dc732ebf6794bbfbbb to your computer and use it in GitHub Desktop.
Save Skyyo/de44d33f08bc37dc732ebf6794bbfbbb to your computer and use it in GitHub Desktop.
perf_snippet_14
@Composable
fun StateReadsInlinedComposablesSolution2Screen() {
var count by remember { mutableStateOf(0) }
Column {
TextWrapper(provideCount = { count })
Button(onClick = { count++ }) {
Text(text = "count++")
}
}
}
@Composable
fun TextWrapper(provideCount: () -> Int) {
Text(text = "Count: ${provideCount()}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment