Trio, Airbnb's architecture for Jetpack Compose screen architecture, leverages Mavericks for state management. Props in Trio facilitate simplified and type-safe communication between ViewModels. Props are data classes containing Kotlin properties passed to a Trio by its parent, allowing for dynamic data exchange throughout the Trio's lifetime. Parent Trios define Props for child Trios, ensuring compatibility and compile-time correctness. Props can include Lambda expressions, enabling child screens to communicate back to their parents. To pass Props, the parent Trio uses the launchChildInitializer function, managing the child Trio's lifecycle and ensuring Props are re-established after process recreation. Child ViewModels update their State based on Props changes through the updateStateFromPropsChange function. Non-state Props values are accessible via the props property. Trio's ScreenFlow feature automates the management of screen stacks, sharing state and navigation functions among child screens through Props. The Airbnb Android team has successfully implemented Trio, resulting in faster development cycles and improved code quality.
medium.com
medium.com
Create attached notes ...
