Created
          July 30, 2020 02:41 
        
      - 
      
 - 
        
Save coleenhuang/fc5e2b41f8d0147983dc7115352887d5 to your computer and use it in GitHub Desktop.  
    How to render a component x times with Jsx
  
        
  
    
      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
    
  
  
    
  | //making a loop and putting return statements in it doesn't work | |
| //Need to put the components into an array first before rendering | |
| //This is the right way to do it | |
| let cardList = []; | |
| for (let i=0; i < num; i++) { | |
| cardList.push(<Card key={i} />) | |
| } | |
| return <div>{cardList}</div> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment