# compose


03/04/2024, 9:32 PM
How you design a viewmodel pattern in a compose app that haves a List-List-Detail ui? The app has 3 screens. The first one is a List of categories, the second one is a List of places and the third one is the detail of the Place. In the samples of google codelabs, they are using only one viewmodel for managing that, in that viewmodel they have an UIState that haves the selected category, the selected place and even the list of places selected when you select a category. So they are sharing the same viewmodel for three screens. In theory, you should use a viewmodel for each screen, so... how should I design it? what should have each viewmodel? which variables should have the UIState of each viewmodel of these three screens? Thanks