ReduceOn
public struct ReduceOn<State>
A part of a Reducer
which only gets triggered on certain Action
s or ActionTemplate
s.
-
Creates a
ReduceOn
which only runsreduce
with actions created from the specificedActionTemplate
s.Declaration
Swift
public init<Payload>(_ actionTemplates: ActionTemplate<Payload>..., reduce: @escaping (_ state: inout State, _ action: AnonymousAction<Payload>) -> Void)
Parameters
actionTemplates
The
ActionTemplate
s to filter onreduce
A pure function which takes a
State
and anAction
and returns a newState
.state
The
State
to mutateaction
The
Action
dispatched