title: Reactjs Slicing and keeping indexes
body: <p>I get overlapping indexes 0,1 when slicing and mapping. How would I keep the same index while doing the same thing.I need to get the correct indices for &lt;TextField value={paymentField[index]} onChange={(e)=&gt;{setPaymentFields(e,index)}} variant=&quot;outlined&quot; className={classes.paymentTextField}/&gt; .</p>
  <pre><code> &lt;Grid container xs={12} sm={12} md={12} lg={6} xl={6} className={classes.marginBottom}&gt;
      {paymentRows.slice(0,3).map((row,index) =&gt;
        &lt;Grid key={index} item xs={12} className={classes.alignRow}&gt;
        &lt;Typography className={classes.accordionCheckMarkFor+&quot; &quot;+classes.paymentRowBlock} &gt;
          {row}
        &lt;/Typography&gt;
      
        {editable[1]?(
          &lt;TextField value={paymentField[index]} onChange={(e)=&gt;{setPaymentFields(e,index)}} variant=&quot;outlined&quot; className={classes.paymentTextField}/&gt;
          ):(
          &lt;Typography  className={classes.accordionCheckMarkFor+&quot; &quot;+classes.paymentTextField} &gt;
            {paymentField[index]}
          &lt;/Typography&gt;
        )}
      
        &lt;/Grid&gt;
      )}
  &lt;/Grid&gt;
  &lt;Grid container xs={12} sm={12} md={12} lg={6} xl={6} className={classes.marginBottom} &gt;
      {paymentRows.slice(3,5).map((row,index) =&gt;
        &lt;Grid key={index} item xs={12} className={classes.alignRow}&gt;
        &lt;Typography className={classes.accordionCheckMarkFor +&quot; &quot;+classes.paymentRowBlock} &gt;
          {row}
        &lt;/Typography&gt;
      
        {editable[1]?(
          &lt;TextField value={paymentField[index]} onChange={(e)=&gt;{setPaymentFields(e,index)}} variant=&quot;outlined&quot; className={classes.paymentTextField}/&gt;
          ):(
          &lt;Typography className={classes.accordionCheckMarkFor+&quot; &quot;+classes.paymentTextField} &gt;
            {paymentField[index]}
          &lt;/Typography&gt;
        )}
      
        &lt;/Grid&gt;
      )}
  &lt;/Grid&gt;
  </code></pre>