const reviews = (state=[], action) => {
  switch (action.type) {
    case 'ADD_REVIEW':
    return [
      ...state, {
        id: action.id,
        reviewer: action.reviewer,
        text: action.text,
        rating: action.rating,
        flag: false
      }
    ]
    case 'DELETE_REVIEW':
    return state.filter(review => review.id !== action.id);
    case 'FLAG_REVIEW':
    return state.map(review => review.id === action.id ? Object.assign({}, review, { flag: action.flag}): review)
    case 'RATE_REVIEW':
    return state.map(review => review.id === action.id ? [...review, {rating: action.rating}]: review)
    default:
    return state;
  }
}

export default reviews;

@@ -81,24 +81,26 @@
 EVIEW':%0A    
+  
 return %5B%0A   
@@ -96,16 +96,18 @@
 eturn %5B%0A
+  
       ..
@@ -124,16 +124,18 @@
         
+  
 id: acti
@@ -141,16 +141,18 @@
 ion.id,%0A
+  
         
@@ -186,16 +186,18 @@
         
+  
 text: ac
@@ -207,16 +207,18 @@
 n.text,%0A
+  
         
@@ -248,16 +248,18 @@
         
+  
 flag: fa
@@ -268,18 +268,22 @@
 e%0A      
+ 
+ 
 %7D%0A
+  
     %5D%0A  
@@ -298,32 +298,34 @@
 DELETE_REVIEW':%0A
+  
     return state
@@ -384,32 +384,34 @@
  'FLAG_REVIEW':%0A
+  
     return state
@@ -532,24 +532,26 @@
 EVIEW':%0A    
+  
 return state
@@ -591,17 +591,17 @@
 on.id ? 
-%5B
+%7B
 ...revie
@@ -603,17 +603,16 @@
 review, 
-%7B
 rating: 
@@ -628,10 +628,10 @@
 ting
+ 
 %7D
-%5D
 : re
@@ -649,16 +649,18 @@
 efault:%0A
+  
     retu

Edit RATE_REVIEW statement