0.0.4 • Published 7 years ago

ideal-redux-utils v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Redux utils

Installation

npm install --save ideal-redux-utils

Example

import createReducer, { createAction } from 'ideal-redux-utils'

export const { type: SET_TEXT, action: setText } = createAction('SET_TEXT', 'text')

/*
export const SET_TEXT = 'SET_TEXT'

export function setText(text) {
  return {
    type: SET_TEXT,
    text,
  }
}
*/

export default createReducer({
  text: '',
}, {
  [SET_TEXT]: (state, { text }) => ({ ...state, text }),
})

/*
export default function reducer(state = {
  text: '',
}, action) {
  switch (action.type) {
    case SET_TEXT {
      return { ...state, text: action.text }
    }
    default: {
      return state
    }
  }
})
*/
0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago