Hi ! Let's say I've built an `@Composable` named `...
# compose
l
Hi ! Let's say I've built an
@Composable
named
NonInteractiveZone
which has some process running or not based on a
Boolean
state (let's say
shouldBeRunning
). I would like to let other
@Composable
call some "methods/events" on it, let's say
startProcess()
and
endProcess()
. So that I could call
myNonInteractiveZone.startProcess()
. Can I achieve something like that with a
@Composable
? More in the thread.
And inside
NonInteractiveZone
:
Copy code
fun startProcess() {
   shouldBeRunning = true
}

fun stopProcess() {
   shouldBeRunning = false
}
Both methods are already implemented, and are not simple callbacks.
Or is the answer too obvious ? (I'm just a bit lost, as
@Composable
are just simple functions)
Sorry for this dumb question : I think I should make a state hoisting around the
shouldBeRunning
state, and remove
startProcess()
and
stopProcess()
. But rather change this
shouldBeRunning
from the most common ancestor.
👍 2
z
Yea this sounds like a state hoisting thing I think
👍 1