Skip to content

Instantly share code, notes, and snippets.

@devDeejay
Created September 19, 2021 19:38
Show Gist options
  • Save devDeejay/0418b7ff8fd3ae9c8ccd4c9d568a3d09 to your computer and use it in GitHub Desktop.
Save devDeejay/0418b7ff8fd3ae9c8ccd4c9d568a3d09 to your computer and use it in GitHub Desktop.
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
// Calling our Refactored function
GreetUser("DEEJAY")
}
}
// To Live Preview This
@Composable
fun GreetUser(name: String) {
Text(text = "Hello $name!")
}
// We annotate this one with
// @Preview
@Preview
@Composable
fun PreviewGreetUser() {
// Calling our function
// which we want to Preview
GreetUser("Medium")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment