Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import createActionCreator from './createActionCreators' // path to the file
- const add = createActionCreator(ADD_TODO, { firstName: 'arun', lastName: 'kumar', addresses: ['mumbai', 'delhi'] })
- const edit = createActionCreator(EDIT_TODO, { id: 10, firstName: 'arun', lastName: 'kumar', accounts: [{ accountType: 'saving' }, { accountType: 'current' }] });
- const remove = createActionCreator(REMOVE_TODO, { id: 10 })
- // Produces below output
- console.log('add', add())
- // {type: "ADD_TODO", firstName: 'arun', lastName: 'kumar', addresses: ['mumbai', 'delhi']}
- console.log('edit', edit())
- // {type: "EDIT_TODO", id: 10, firstName: 'arun', lastName: 'kumar', accounts: [{ accountType: 'saving' }, { accountType: 'current' }]}
- console.log('remove', remove())
- // {type: "ADD_TODO", id: 10}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement