Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export default function messages(state = getMessages(10), action) {
  2.   switch (action.type) {
  3.     case SEND_MESSAGE:
  4.       const { message, userId } = action.payload;
  5.       return {
  6.         ...something
  7.           }
  8.         }
  9.       };
  10.     case EDIT_MESSAGE:
  11.       const { message, userId } = action.payload;
  12.       return state;
  13.     default:
  14.       return state;
  15.   }
  16. }
  17.  
  18. ==> Syntax error : message et user_id déjà déclarés
  19.  
  20. soluce possible :
  21. case SEND_MESSAGE: {
  22.       const { message, userId } = action.payload;
  23.       return {
  24.         ...something
  25.           }
  26.         }
  27.       };
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement