I have react js code below where I put semantic ui react Dropdown component in a map. yoe is an array in state, I put value={yoe[i]}, but how can I have the index i being passed to the onChange prop? I tried the following, but the method onAddYoe seems doesn't recognize i. Can someone kindly help? Thanks!
{specialties &&
specialties.map((specialty, i) => {
return (
<div className="a-row" key={i}>
<div className="a-col-md-12">
<div className="a-text-box">
<label className="a-mb-5">
Years of experience in {specialty}
</label>
<br />
<Dropdown
placeholder="0-1 years"
fluid
selection
value={yoe[i]}
options={this.yoeList}
onChange={this.onAddYoe(i)}
/>
{errors.email ? (
<span className="error">Email Required</span>
) : null}
</div>
</div>
</div>
);
})}