Loop in react-native

前端 未结 6 1632
慢半拍i
慢半拍i 2021-02-04 23:57

I want to make a list of fields depending on the number of the player that user has selected. I wanted to make something like this:

generatePaymentField() {
             


        
6条回答
  •  清酒与你
    2021-02-05 00:45

    This should work

    render(){
    
    	var payments = [];
    
    	for(let i = 0; i < noGuest; i++){
    
    		payments.push(
    			
    				
    					
    				
    				
    					
    				
    				
    					
    				
    			
    		)
    	}
    	
    	return (
    		
    			
    				No
    				Name
    				Preference
    			
    
    			{ payments }
    		
    	)
    }

提交回复
热议问题