Last active
          March 7, 2018 21:43 
        
      - 
      
 - 
        
Save RobertFischer/19b3f4745dce22d882d8c9b98846576e to your computer and use it in GitHub Desktop.  
    Button Click -- https://reactjs.org/docs/react-component.html#setstate
  
        
  
    
      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
    
  
  
    
  | onClick=>{ | |
| () => this.setState({pageNumber:this.state.pageNumber+1}) | |
| } | 
  
    
      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
    
  
  
    
  | onClick={ | |
| () => this.setState(({pageNumber}) => {pageNumber:pageNumber+1}) | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
NOTE
The way
increment-per-clickis implemented, each time the click the button, they will increment the page number. So if you click3times, it'll advance the page from pagextox+3.For
increment-once, this would mean that until the page gets re-rendered, clicking the button3times would still just move fromxtox+1-- and it will always bex+1until it's re-rendered with an updatedpageNumber.