Skip to content

Instantly share code, notes, and snippets.

@lulalachen
Last active June 13, 2016 06:52
Show Gist options
  • Save lulalachen/a642a9c164ffb4967152785961779864 to your computer and use it in GitHub Desktop.
Save lulalachen/a642a9c164ffb4967152785961779864 to your computer and use it in GitHub Desktop.

Structure

actions 
  |—— oneAction
      |—— constants.js
      |—— index.js
  |—— otherAction
      |—— constants.js
      |—— index.js

actions/oneAction/constants.js

export const GET_ONE_ACTION_SUCCESS = 'GET_ONE_ACTION_SUCCESS'
export const getOneActionSuccess = () => ({
  type: GET_ONE_ACTION_SUCCESS,
})

actions/oneAction/index.js

import { getOneActionSuccess } from './constants'

export getOneAction = () => dispatch => dispatch(getOneActionSuccess())

In component (assume actions is in alias path)

import { getOneAction } from 'actions/oneAction'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment