Skip to content

Instantly share code, notes, and snippets.

@baptistemanson
Last active July 28, 2017 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baptistemanson/3e86092de99b4df26248a113e05e3c3d to your computer and use it in GitHub Desktop.
Save baptistemanson/3e86092de99b4df26248a113e05e3c3d to your computer and use it in GitHub Desktop.
// 1 - instead of
const action = {type: 'my-app/users/ADD', {id: 1, name:'Bat'}}
/* we can */
// 2 - we define an action creator in the users file
export const addUser = payload => ({type: 'my-app/users/ADD', payload})
// we can get the action in another file when we need it
import {addUser} from '../redux/users'
const action = addUser({id: 1, name:'Bat'})
@mikaturk
Copy link

umm at line 2 there is no 'payload: ' before the '{id: 1, name: 'Bat'}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment