ReduxStore

class ReduxStore<S : Any, A : RAction>(reducer: ReducerFun<S, A>, initialState: S, middlewares: <ERROR CLASS><S>)

A class implementing redux pattern backed by the Redux Kotlin library.

Parameters

S

redux state type

A

redux action type

reducer

a reducer function

initialState

an initial state

middlewares

a list of optional Redux Kotlin middlewares

Constructors

Link copied to clipboard
fun <S : Any> ReduxStore(reducer: ReducerFun<S, A>, initialState: S, vararg middlewares: <ERROR CLASS><S>)

Creates a Redux store with given reducer function and initial state.

Functions

Link copied to clipboard
fun dispatch(action: A)

Dispatches a synchronous action object.

fun dispatch(actionCreator: ActionCreator<A, S>)

Dispatches an asynchronous action function.

Link copied to clipboard
open fun getState(): S
Link copied to clipboard
open fun subscribe(observer: (S) -> Unit): () -> Unit