Reactor
A reactor is just a glorified reducer – "glorified" meaning it has one optional additional property, process
, whose value is a processor.
Reactors are typically composed together to create reactor hierarchies. These are analogous to reducer hierarchies in Redux. A reactor hierarchy is used to create a state tree, delegating management of the pieces of that tree to individual reactors. Read more about creating a reactor hierarchy in the reducer layer guide.
Definition
interface Reactor<S = any> {
(state: S, action: Action): S
process?: Processor
}
In other words, a Reactor is a reducer.
process - Optional - A valid processor.
Notes
Processors are the king of the beastly side effects model of Zedux. Read more about them in the processors guide.
While there's nothing wrong with putting reactors together yourself, Zedux ships with a high-level api for creating them. See react and the ZeduxReactor api.
While there's nothing wrong with putting reactor hierarchies together yourself, Zedux ships with a high-level api for creating them. See store.use()
.