Skip to content
Commitwise
Menu

Unidirectional data flow

Also called: UDF

An architecture rule where state flows down from one owner to the UI, and user actions flow back up as events.

Definition

In unidirectional data flow (UDF), one state holder, usually a ViewModel, owns the screen's state and exposes it as a read-only, immutable value. The UI only displays that state and reports what the user did as events. The owner handles each event, produces a new state, and the UI renders it again. Because there is a single owner and a single direction, the screen can't get into states nobody created on purpose.

In practice

Tapping Add calls viewModel.onAction(AddClicked); the ViewModel saves the item and emits a new UiState, which the screen collects and shows.

Learn it in context

Lessons that use this term.

Related terms

Esc

Type to search the whole site.