Hey folks, so I've got a few layers of composable ...
# compose
g
Hey folks, so I've got a few layers of composable function, I push my viewmodel into the upper function and it passes list data to a lazycolumn, which passes data to a row, which passes data to a card which shows an images and has a clickable button, all good, my problem is when I have a function on the viewmodel I want to call when the button is clicked, I can't quite figure out how to pass a reference to this function through a couple of layers until I reach the row where I can do
ImageBox(modifier = Modifier.weight(1f), imageItem = item, onClick = { onClick(item) } )
and then in the card I can do
modifier.clickable(onClick = onClick)
. I've tried doing something like
onClick = viewModel.selectImage
but I'm just not sure the right way to do This might be a more kotlin question, but I'm encountering it in compose so thought this might be a good place to ask