Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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

mikaturk commented Jul 28, 2017

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