Anatomy of an @Composable Function
Read a Composable and spot what makes it special.
What Is a Composable?
A Composable is just a Kotlin function that describes a piece of UI. Call it, and Compose draws that UI on screen. It is the building block of everything. 🧱
The @Composable Annotation
The magic marker is @Composable above the function. It tells the Compose compiler this function can emit UI and may be recomposed when data changes.
@Composable
fun Greeting() {
Text("Hello!")
}All lessons in this course
- What Compose Replaces: Goodbye XML
- Set Up Android Studio for Compose
- Anatomy of an @Composable Function
- Run Your First App on the Emulator