cyclejs-redux
v1.0.0
Published
A cycle.js driver for redux - Written in Typescript
Downloads
2
Readme
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);