So I was trying to setstate a variable with jsx and spread operator but no matter how I try I get stuck without any output or with errors can anyone please help me how to achieve this??
Here is the part of program
handleNumberOfGyInput=(e)=>{
e.preventDefault();
this.setState({numberofGyBranchesInput:null})
for(let i = 1;i<this.state.numberofGyBranches;i++){
this.setState(prevState=>({gyAddressInput:
...prevState.gyAddressInput +
<React.Fragment >
<Row>
<Form.Group className="mb-3" controlId="formGridAddress1">
<Form.Control placeholder="Address of something(s) {click on + button below to add more addresses for diffrent branches}" />
</Form.Group>
</Row>
</React.Fragment>
}))
}
}
so here is what I am trying to achieve :
I want my JSX Component (between "Row") to be rendered as many times as number that this.state.numberofGyBranches variable carries can anyone tell me how??