Advertisement
Guest User

Untitled

a guest
May 25th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import createActionCreator from './createActionCreators' // path to the file
  2.  
  3. const add = createActionCreator(ADD_TODO, { firstName: 'arun', lastName: 'kumar', addresses: ['mumbai', 'delhi'] })
  4. const edit = createActionCreator(EDIT_TODO, { id: 10, firstName: 'arun', lastName: 'kumar', accounts: [{ accountType: 'saving' }, { accountType: 'current' }] });
  5. const remove = createActionCreator(REMOVE_TODO, { id: 10 })
  6.  
  7. // Produces below output
  8. console.log('add', add())
  9. // {type: "ADD_TODO", firstName: 'arun', lastName: 'kumar', addresses: ['mumbai', 'delhi']}
  10.  
  11. console.log('edit', edit())
  12. // {type: "EDIT_TODO", id: 10, firstName: 'arun', lastName: 'kumar', accounts: [{ accountType: 'saving' }, { accountType: 'current' }]}
  13.  
  14. console.log('remove', remove())
  15. // {type: "ADD_TODO", id: 10}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement