Certainly you can attach composables to classes, a...
# compose
j
Certainly you can attach composables to classes, and you'll get something analogous to lambdas in the process (ie. a composable with captured data that you can pass around). Sometimes it's useful, but usually it's people trying to shim Compose into their old mental models, and usually it doesn't end well. In the very early days of Compose (before first public release), we actually had full support for Composable classes. We made a conscious decision to remove that functionality, for a variety of reasons that we might go into in a blog post at some point. But at a high level, be aware that attempting to use this pattern will encourage code styles that end up harming long-term readability and maintainability by creating complexity in the wrong places. Using functions helps break people of their imperative prior inclinations. I'd suggest using top-level Composable functions until you've fully mastered Compose, and then iterate on other architectures after you've had the aha moments that lead us to design Compose in the first place.