childReactiveState

Creates and attaches a child ReactiveState.

This merges the child's ReactiveState.eventNotifier and ReactiveState.loading into the parent.

Example:

// The parent has to also implement the child events
interface ParentEvents : ChildEvents {
fun onSomeEvent()
}

class ParentViewModel(scope: CoroutineScope) : BaseReactiveState<ParentEvents>(scope) {
val childViewModel by childReactiveState { ChildViewModel(scope) }
}

interface ChildEvents : ErrorEvents {
fun onSomeChildEvent()
}

class ChildViewModel(scope: CoroutineScope) : BaseReactiveState<ChildEvents>(scope) {
init {
launch {
// ...
eventNotifier {
onSomeChildEvent()
}
}
}
}