cyclejs-redux

A cycle.js driver for redux - Written in Typescript


Keywords
cyclejs, redux
License
MIT
Install
npm install cyclejs-redux@1.0.0

Documentation

cyclejs-storage

A Cycle.js Driver for using redux.

Installation

npm install --save cyclejs-redux

Usage

Basics:

import Cycle from '@cycle/xstream-run';
import { makeStateDriver } from 'cyclejs-redux';

function reducer(state, action)
{
    switch(action.type)
    {
    case 'increment': return Object.assign({}, state, { counter: state.counter + 1 });
    case 'decrement': return Object.assign({}, state, { counter: state.counter - 1 });
    default: return state;
    }
}

function main(sources) {
  // ...
}

const drivers = {
  storage: makeStateDriver(reducer, { counter: 0 })
}

Cycle.run(main, drivers);