I hope to get Context in @Composable function, but Code A is wrong.
At present, I have to use Code B to get Context.
I think Code B is not good, is there other way to get Context in @Composable function ?
Code A
@Composable
fun RecordTitleWithToolBar(){
IconButton(
onClick = {
LocalContext.current.toast(R.string.suggest_share_app)
}
) {
}
}
Code B
@Composable
fun RecordTitleWithToolBar(){
val context= LocalContext.current
IconButton(
onClick = {
context.toast(R.string.suggest_share_app)
}
) {
}
}