babel-plugin-s2s-d-action-creater
generate action constants
Last updated 2 years ago by akameco .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install babel-plugin-s2s-d-action-creater 
SYNC missed versions from official npm registry.

babel-plugin-s2s-d-action-constants

s2s plugin for d

Install

$ yarn add --dev babel-plugin-s2s-d-action-constants

Example

IN:

import { type UserRes } from '../../types/Api'
import * as constants from './constants'

export type FetchUser = {
  type: typeof constants.FETCH_USER,
  payload: string,
}

export type FetchUserSuccess = {
  type: typeof constants.FETCH_USER_SUCCESS,
  payload: UserRes,
}

export type Action = FetchUser | FetchUserSuccess

OUT:

// @flow
import { type UserRes } from '../../types/Api'
import * as constants from './constants'
import type { Action } from './types'

export const fetchUser = (payload: string): Action => {
  return {
    type: constants.FETCH_USER,
    payload,
  }
}

export const fetchUserSuccess = (payload: UserRes): Action => {
  return {
    type: constants.FETCH_USER_USER,
    payload,
  }
}

Usage

{
  ['s2s-d-action-creater']
}

Current Tags

  • 0.1.0                                ...           latest (2 years ago)

1 Versions

  • 0.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (5)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |