Reza Ramesh
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)

}

}

--

--

Reza Ramesh
Reza Ramesh

Written by Reza Ramesh

I am an Android developer and UI/UX designer with 5 years of experience in creating engaging and user-friendly mobile applications

No responses yet