Hi! I am trying to implement some sort of event st...
# getting-started
Hi! I am trying to implement some sort of event store / redux store using corutines in android application Here is the pseudocode:
Copy code
class Store {
  private val channel = Channel<Action>()
  suspend func dispatch(action: Action) {

  init {
    GlobalScope.launch {
      for (action in channel) {
Sadly, this code doesn't work - actions are not reducer. Small detail: If i will explicitly set Dispatchers.Main in init and in dispatch - it work, but defeats my purpose. My goal is to move action processing of main thread.
will build
for each active
and publish.
I am Not an android nor a redux expert, but reducers in redux are pure functions, that take a state, an Action and return the new state. You already have an action, but where is your state? In redux you pass the initial state when you create the store, so i guess it's an instance property of the store. Where is "reduce" defined?
I know this will not solve your problem, but do you know this lib ? https://reduxkotlin.org/