How to use the es/index.createShuttle function in es

To help you get started, we’ve selected a few es examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jaylone / redux-shuttle / example / src / shuttle.js View on Github external
import { createShuttle, createReducer } from 'es/index';
import { combineReducers } from 'redux';

const initState = {
  list: ['King\'s', 'Landing.'],
  name: '',
  visible: false
}

export default createShuttle('App',initState, {
  setList: ['list',  (state, action) => { console.log(action)
    return Object.assign({}, state, {list: action.list});
  }],
  setName: ['name', (state, action) => {
    return Object.assign({}, state, {list: action.name});
  }],
  toggleModal: (state, action) => {
    return Object.assign({}, state, {visible: !state.visible});
  },
  fetchList: ['param'],
  recieveList: ['data', (state, actions) => {
    return Object.assign({}, state, data)
  }],
  fetchAll: null
});