20 Most Asked Jetpack Compose Interview Questions for Android Developers
1. What is recomposition in Jetpack Compose? Recomposition is the process where Jetpack Compose re-executes your Composable functions with new data to update the UI hierarchy. Instead of mutating individual views (like in XML), Compose recreates the UI from scratch for the parts that changed. It uses an intelligent compiler to optimise this process, skipping any Composable functions whose inputs (parameters) have not modified. 2. What triggers recomposition? Recomposition is triggered exclusively by a change in a state object that a Composable function reads. State Updates: Modifications to a Compose State<T> (e.g., a value wrapped in mutableStateOf ). Flow/LiveData Streams: Emitting new values into a StateFlow or LiveData that has been converted to Compose state using .collectAsStateWithLifecycle() or .observeAsState() . 3. How can you avoid unnecessary recomposition? You...