Sep 21, 2023
You need a Store class like this.
class Store<S, A>(private val reducer: (S, A) -> S, initialState: S) {
private val _state = mutableStateOf(initialState)
val state: S
get() = _state.value
fun dispatch(action: A) {
_state.value = reducer(state, action)
}
}