Guest User

Untitled

a guest
Oct 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. // define ADD, addMessage(), messageReducer(), and store here:
  2.  
  3. const ADD = 'ADD';
  4.  
  5. const addMessage = (message) => {
  6. return {
  7. type: ADD,
  8. message
  9. }
  10. }
  11.  
  12. const messageReducer = (state, action) => {
  13. switch(action.type) {
  14. case ADD:
  15. return [...state, action.message]
  16. default:
  17. return state
  18. }
  19. }
  20.  
  21. const store = Redux.createStore(messageReducer, []);
Add Comment
Please, Sign In to add comment