Building State Holders in Compose with Molecule
summary
Argues that Molecule uses the Compose runtime to build state holders (presentation logic, not UI), letting composable functions be turned into StateFlow via launchMolecule so view models shrink and become more testable. Shows a chess‑player app with two independently loading components, claims combine becomes awkward past five inputs and Molecule scales better, offers a moleculeFlow variant and flow testing with Turbine, and cites Cash App and Slack using it in production.
AI-written summary · about
chapters (24)
- 0:00Introduction
- 1:07What is Molecule
- 3:39Counter with Molecule
- 5:42Molecule for state
- 6:44UI vs presentation
- 8:07Traditional UI issues
- 10:36Molecule in MVVM/MVI
- 11:38MVI basics
- 12:23MVI example with Molecule
- 13:48Chess app demo
- 14:32Traditional ViewModel
- 15:14List screen with Molecule
- 16:37Multiple streams in Molecule
- 18:00Details screen with Molecule
- 19:06Adding features with Molecule
- 20:10Real-world ViewModel complexity
- 20:52Molecule vs Flows
- 21:56Flows scalability issues
- 22:38Molecule solves ViewModel problems
- 23:21Optimizing recomposition
- 23:43Reusable state logic
- 25:07Testing Molecule with Turbine
- 25:49Molecule like protein
- 26:30Recap and benefits of using Molecule
related talks
26mMolecule: Using Compose for Presentation Logic
42mDemystifying Molecule: Running Your Own Compositions For Fun And Profit
38mBuilding StateFlows in Android with Jetpack Compose
42mCompose: Beyond Android development
34mBeyond the UI: Compose as a Foundation for Multiplatform Apps
43mHosting our states in Compose
30mModern Compose Architecture with Circuit
29mNavigation and Dependency Injection in Compose
