1.0.1 • Published 5 years ago

babel-plugin-s2s-reducer-case-creater v1.0.1

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

babel-plugin-s2s-reducer-case-creater

s2s plugin: create reducr case pattern using actionTypes

Install

$ npm install --save-dev babel-plugin-s2s-reducer-case-creater

Example

actionTypes.js

export const Actions = {
  INCREMENT,
  DECREMENT,
}

IN:

export default function(state: State = initialState, action) {
  switch (action.type) {
    case Actions.INCREMENT:
      return { ...state, count: state + 1 }

    default:
      return state
  }
}

OUT:

export default function(state: State = initialState, action) {
  switch (action.type) {
    case Actions.DECREMENT:
      return {
        ...state,
      }

    case Actions.INCREMENT:
      return { ...state, count: state + 1 }

    default:
      return state
  }
}

And, Just change {...state}{...state, count: staet - 1}.

Usage

{
  ['s2s-reducer-case-creater']
}

from

type: string required: true

actionTypes.js path

If you use s2s, you don't use this option. s2s handle it automatically.

1.0.1

5 years ago

1.0.0

5 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago