Hi, is it safe to remember current context, and use it to launch some things dependent on that context?
Copy code
@Composable
fun rememberX(context = LocalContexxt.current) = remember { DataClass(context = contexxt) }
@Composable
fun Sample() {
val x = rememberX()
Button(text = "test", onClick = { // do something with context via x.context })
}
j
Jakub Syty
06/27/2023, 1:42 PM
it should be fine, in most (if not all) cases the remember will live "shorter" then the context itself i think. If you want to be safe you can do