Should ViewModels ever be reused across views? If yes, then when?

From what I read, in MVVM it is considered best practice for each view to have its own corresponding ViewModel, which makes sense since the ViewModel model should be a View model. Generally, reusing ViewModels with different views seems discouraged. It's always like that? If not, what are the general guidelines for determining whether to reuse the ViewModel this way?

In one situation, I might think where reusing ViewModel with a different view may be satisfactory, when two views use the same data from the Model, and the Views themselves simply present the data in different ways. If views can process the same data in different ways, one ViewModel can efficiently serve each view.

+5
source share
1 answer

The reason we have rules is because you think before breaking them.

: ViewModel . , , , .

, . , , .

, viewmodel, .

+8

All Articles