Skip to content

MVVM with React

For most screens, the React hooks keep state in the component and that’s exactly right. But as a screen’s logic grows — orchestrating several commands, deriving display state, reacting to navigation — that logic starts to crowd the markup. The Model-View-ViewModel approach moves it into a dedicated view model class: the component renders, the view model decides. The result is logic you can test and reuse independently of the JSX.

Reach for MVVM when a screen has substantial behavior; stay with plain hooks when it doesn’t.

TopicWhat it covers
Using a view modelBind a component to a view model and drive it from there.
MVVM contextHow the MVVM context is established and resolved.
TSyringeDependency injection for view models with TSyringe.
BrowserWorking with browser APIs and navigation from a view model.
DialogsDriving dialogs from a view model.
IdentityAccessing identity and user context in MVVM.
MessagingMessaging and communication patterns in MVVM.

New to the frontend? Start with the React hooks first — MVVM is the next step up, not the starting point.