Howaye
05/05/2025, 9:39 PMCompositionLocal
to pass composable lambda to a child composable? Something like below.
val LocalComposable = compositionLocalOf<@Composable (Modifier) -> Unit> { { Box {} } }
@Composable
fun DescendantDeepInHiearchy() {
LocalComposable.current
}
I did see in the Alternatives to Consider section about IOC, mentioning composable lambdas benefiting from IOC. I didn't find whether it would be a good or bad idea to to use composable lambdas in CompositionLocal
Jonathan
05/05/2025, 9:46 PM@Composable
lambda “down the chain”. It follows patterns already establish in Compose. All layouts take a composable lambdas and use them display content.