7
Exploring App Architecture
In Chapter 6, Building a Real-World App, we combined several key techniques of Jetpack Compose, including state hoisting, app theming, and navigation, in a real-world example. ComposeUnitConverter stores state in a ViewModel and eventually persists it using the Repository pattern. In this chapter, I will show you how to pass objects to a ViewModel upon instantiation and use these objects to load and save data. In Chapter 2, Exploring the Key Principles of Compose, we examined features of well-behaved composable functions. Composables should be free of side effects to make them reusable and easy to test. However, there are situations when you need to either react to or initiate state changes that happen outside the ...
Get Android UI Development with Jetpack Compose - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.