middleware
inline fun <State> middleware(crossinline block: MiddlewareScope<State>.(action: Action) -> Unit): Middleware<State>
Creates a middleware.
Example of usage:
fun customMiddleware() = middleware<AppState> { action ->
when (action) {
is CustomAction -> dispatch(OtherAction)
else -> next(action)
}
}
Content copied to clipboard