react()

A standard tool for creating reactors. It's mostly just syntactic sugar for switch statements or action-reducer maps, but, of course, with processors rolled in.

react() is a factory for creating ZeduxReactors.

Definition

(initialState: any) => ZeduxReactor

initialState - The initial state of the reducer. This will define the state shape handled by all sub-reducers and sub-processors of the reactor.

Usage

import { react } from 'zedux'

const reactor = react()

Motivation

We've seen what happens when a library leaves the implementation of low-level details (read: boilerplate) up to the user. We get a massive divide between those who think explicitly creating all boilerplate is best, and a couple hundred libraries offering a "better" way.

Zedux provides a high-level api for action and reducer creation out of the box. Since it's actually a pretty good one, the number of competing libraries will be minimal. And the low-level people, while unhindered, will at least not be joined by those whose only reason for writing boilerplate is, "Well, that's how the docs do it."

Notes

Check out the ZeduxReactor api to see how to use this bad boy.

results matching ""

    No results matching ""