Jetpack Compose Skill
Best Practices
- State Hoisting: Move state up to the caller to make composables stateless and reusable.
- Side Effects: Use
LaunchedEffectorDisposableEffectfor side effects. Never run them directly in the function body. - Stability: Ensure classes used in params are
@Stableor@Immutableto skip unnecessary recompositions.
Common Pitfalls
- Excessive Recomposition: Reading state too high up or not using keys in LazyColumns.
- Context: Holding references to Activity Context inside Composables (Leak risk).
References
Converted and distributed by TomeVault — claim your Tome and manage your conversions.