toBlocState

fun <State : Any, Proposal : Any, Model : Any, ReduxModel : Any> Store<ReduxModel>.toBlocState(    context: <Error class: unknown class>,     select: <Error class: unknown class><ReduxModel, Model>,     map: <Error class: unknown class><Model, State>): <Error class: unknown class><State, Proposal>

Extension function to convert a Redux store to a BlocState.

Return

a BlocState with state reflecting the selected and mapped redux store state: state = map(select(redux model))

Example:

store.toBlocState(
  context = context,
  select = { reduxModel -> reduxModel.books },
  map = { model ->
    when {
      model.isLoading -> BookState.Loading
      else -> model.books.toState()
    }
  }
)

Parameters

select

memoized selector function to select sub-state from the (global) redux state

map

maps the selected sub state to bloc state if needed (can be the identity function)