اولا يعني اي compose
هي Jetpack Compose هو الـ modern UI toolkit في Android، بنبني بيه واجهة التطبيق باستخدام Kotlin code وComposable functions بدل ما نبنيها بملفات XML.
| XML | Jetpack Compose |
|---|---|
| UI is written in XML | UI is written in Kotlin |
| Imperative | Declarative |
| We use Views such as TextView, Button | use Text(), Button() |
We need findViewById or ViewBinding to handle the views. |
There is no traditional ViewBinding |
| Changing the UI is usually done manually. | The UI updates automatically as the state changes. |
| State management أصعب نسبيًا | State وrecomposition جزء أساسي من Compose |
| XML + Kotlin | Kotlin is only for UI |
الإجابة : الـ Recomposition يعني إعادة تنفيذ جزء من الـ Composables لما الـ State اللي بيقرأ منها تتغير.
الإجابة : بتحصل لما:
State<T>/MutableState) والـ value تتغيرالإجابة :
remember لتخزين قيم بين recompositionsderivedStateOf للاشتقاق بدل ما تعمل حسابات متكررة.