ReduxStore

class ReduxStore<S : Any, A>(reducer: <Error class: unknown class><S, A>, initialState: S, middlewares: dynamic)

A class implementing redux pattern backed by the original Redux JS library.

Parameters

S

redux state type

A

redux action type

reducer

a reducer function

initialState

an initial state

middlewares

a list of optional Redux JS middlewares

Constructors

Link copied to clipboard
constructor(reducer: <Error class: unknown class><S, A>, initialState: S, vararg middlewares: dynamic)

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

Functions

Link copied to clipboard
fun dispatch(action: A): <Error class: unknown class>

Dispatches a synchronous action object.

fun dispatch(actionCreator: ActionCreator<dynamic, S>): <Error class: unknown class>

Dispatches an asynchronous action function.

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