Declarative UI
A UI style where you describe what the screen should look like for the current data, and the framework updates the screen when the data changes.
Definition
In imperative UI code you find a label and change its text. In declarative UI you write a function or view that returns the whole screen for a given state, and the framework compares it with what is shown and applies the differences. SwiftUI, Jetpack Compose, React and Flutter all work this way, which removes a whole class of bugs where the screen and the data disagree.
In practice
A like button is described as a filled heart when isLiked is true and an empty one otherwise; tapping only flips isLiked.
Learn it in context
Lessons that use this term.