@Composable đánh dấu một Kotlin function là pure, idempotent (cùng input → cùng output), và được gọi bởi Compose runtime chứ không phải do bạn gọi thủ công — đây là ràng buộc quan trọng nhất.
- Function phải trả về Unit, không có side effect trực tiếp, và chạy nhanh.
- Annotation
@Composablebáo cho Compose runtime theo dõi recomposition và state change.
@Composable marks a Kotlin function as pure, idempotent (same inputs = same output), and invoked by the Compose runtime — not manually.
- This contract is the key non-obvious constraint.
- The function returns Unit, must have no direct side effects, and must be fast.
- The annotation tells the Compose runtime to track recompositions and state changes.