Last active
July 28, 2017 20:42
-
-
Save baptistemanson/3e86092de99b4df26248a113e05e3c3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
umm at line 2 there is no 'payload: ' before the '{id: 1, name: 'Bat'}'