Installation

reactorx is built on top of js-csp, which is included in the distribution.

You still need to install babel-polyfill (npm install --save babel-polyfill).

This is because Safari (most notably) doesn't support generators yet, so we need to bake in the support for those features.

import 'babel-polyfill'
// then
import React from 'react'

API

Although reactorx is designed with ES6 in mind, and as such, a transpiler is required, it's compatible with es5.

The examples contained in the repo provide a hot-reloadable dev environment based on Webpack and Babel 6.

createStore

createStore(initialState, actions, optionals = {}, capacity = 623)

@param {object} state - Object tree with the initial state of the store
@param {object} actions - Object with methods that represent actions
@param {object} optionals (defaults to {})- This parameter will be sent to each action as an additional argument
@param {integer} capacity (defaults to 623) - Buffer size of the underlying dispatch queue
@return {object} - Returns the store, composed of a subscribe function and an actions property

The store returned by createStore has the following responsibilities:

Holds application state

Registers a callback to notify changes via subscribe(callback)

Allows state to be mutated via a collection of actions

The subscribe callback function receives the current state of the store and all the actions that can be invoked to mutate this state