delegate
Create a new StoreDelegate and install it as a storeDelegatePlugin.
The delegate can be used to project the state of the delegate store to the principal store and handle Actions using consume. The mode will be used to determine how and when the state/actions are projected.
val store = store(Loading) {
val feedState by delegate(feedStore) {
// handle actions
}
whileSubscribed {
feedState.collect { state ->
// use projection.
}
}
}
Return
A StoreDelegate instance that can be used to access the delegate store's state
Parameters
The store to delegate to
The delegation mode that determines when and how the delegate's state/actions are projected
Optional name for the plugin, by default allows only one plugin per delegate.
Whether to automatically start the delegate store when the plugin is installed
Whether to wait for the delegate store to start before continuing (when start is true)
Optional function to handle actions from the delegate store