I am having issue creating a store. The Store requ...
# redux-kotlin
I am having issue creating a store. The Store requires the first argument to follow the
type alias Reducer<S,A> = (S,A) -> S
When I create function that looks like
fun myfun(State:SomeStateClass, action:Action):SomeStateClass
Then I get a mismatch type error on myFun when entered as below.
val store = createStore(myFun(), SomeStateClass())
is this a know issue, or is there a workaround?
myFun() will invoke the function, not pass a reference to the function to createStore. I thought using ::myFun in the call to createStore would work, but it also causes a type mismatch. What works is changing the definition of myFun to a val referencing a function like this:
val myFun: Reducer<SomeStateClass> = { state, action -> your function definition here }
Then in the call to createStore:
val store = createStore(myFun, SomeStateClass())
Thank you ­čśÇ