Created
          December 5, 2017 02:07 
        
      - 
      
 - 
        
Save rafaellucio/0bc10ae191ff3ed3a58358a2347265f9 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function brokenReducer(state = initialState, action) { | |
| switch(action.type) { | |
| case 'INCREMENT': | |
| // NO! BAD: this is changing state! | |
| state.count++; | |
| return state; | |
| case 'DECREMENT': | |
| // NO! BAD: this is changing state too! | |
| state.count--; | |
| return state; | |
| default: | |
| // this is fine. | |
| return state; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment