Skip to content
RED SAGSkills
easyMobile App Developer interview question

What is the difference between declarative UI (Compose, SwiftUI, Flutter, React Native) and the older imperative style?

What the interviewer wants to hear

  • Imperative UI means creating views and changing them step by step
  • Declarative UI describes what the screen looks like for a given state
  • The framework rebuilds or recomposes when state changes
  • State should be the single source of truth, which reduces sync bugs
  • Needs care with state ownership and avoiding unnecessary rebuilds

Model answer

In the imperative style, like Android XML views or UIKit, you build views once and then mutate them by hand: find the label, set its text, hide the spinner. It is easy to forget a step and leave the screen out of sync with the data. In declarative frameworks like Jetpack Compose, SwiftUI, Flutter and React Native, you write a function that describes the UI for the current state. When state changes, the framework re-runs that description and updates only what changed, through recomposition or diffing. This makes state the single source of truth and removes a whole class of sync bugs. The trade-off is that you must think about who owns each piece of state, and avoid expensive work or unstable inputs that cause too many rebuilds.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy Mobile App Developer questions