Big Chungus
08/03/2019, 3:40 PMexternal fun <A, T1, R> compose(function1: (T1) -> R, function2: (A) -> T1): (A) -> R
&
external fun <S, A, R> createStore(
reducer: Reducer<S, A>,
preloadedState: S,
enhancer: Enhancer<S, Action, Action, A, R>
): Store<S, A, R>
R especiallyRobert Jaros
08/03/2019, 3:50 PMBig Chungus
08/03/2019, 3:51 PMRobert Jaros
08/03/2019, 3:52 PMBig Chungus
08/03/2019, 3:53 PMBig Chungus
08/03/2019, 3:53 PMJoffrey
08/14/2019, 4:12 PMWrapperAction
is, I believe I have found the answer.
It's basically a built-in subinterface of the default redux Action
that provides a default value for the type
field, so that you can use plain data classes as actions.
To be more precise, as far as I understood, Store<S, A, R>
defines A
as the input action type for dispatch()
and the reducer, and R
as the return type of dispatch()
.
When using enhancers, you can basically "enhance" the store to accept a new action type instead of A
and return a new type from dispatch()
instead of R
.
There is a built-in enhancer provided by the kotlin-redux
wrapper, which makes WrapperAction
the new return type of dispatch
and RAction
the new input type of dispatch
and the reducer. Internally, it simply wraps the reducer and dispatch
.