Widgets defined in XML, but state change (and ownership), event handling etc. happens in the code, leading to poor separation of concerns.
Jetpack Compose:
- Complete rewrite of Android UI toolkit
- Unbundled from underlying Android OS
- Less boilerplate than views
- State ownership, event handling are more clearly delineated
- Can use Compose within View-based activities
- Often, navigation is often still done with Views (at least for now)
‘Components’ are functions the @Composable annotations:
- Adds a trailing lambda function which allows nesting of Composable functions in a tree
- Kotlin code: can have conditionals, loops etc.
- Compose runtime re-renders the app view when the state changes