I have a picker that allows user to select a number from 1 to 5 and based on the selection lets say user picks 2 a next screen shows that should run a loop 2 times and display the component two times. I have this code as of now:
function IndividualInfoCard({ noOfInd }) {
var noOfIndSelected = noOfInd;
return (
<View>
<IndividualInfo title={'Person 1'} />
<IndividualInfo title={'Person 2'} />
<IndividualInfo title={'Person 3'} />
<IndividualInfo title={'Person 4'} />
<IndividualInfo title={'Person 5'} />
</View>
);
}
These 5 components I need to place all of these as per the number in noOfIndSelected. I searched but couldn't figure out how to do it with .map so how do I achieve it?