title: i'm wanting onChange to keep generate id ReactJS
body: <p>I have function makeid</p>
  <pre class="lang-js prettyprint-override"><code>const makeid = (length) =&gt; {
    var result = &quot;&quot;;
    var characters =
      &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&quot;;
    var charactersLength = characters.length;
    for (var i = 0; i &lt; length; i++) {
      result += characters.charAt(Math.floor(Math.random() * charactersLength));
    }
    return result;
  };
  </code></pre>
  
  <p>and i have function createArray use makeid</p>
  <pre class="lang-js prettyprint-override"><code>const createArray = (x) =&gt; {
    let array = [];
    const object = {
      id: makeid(5),
    };
    for (let i = 1; i &lt;= x; i++) {
      array.push(object);
    }
    return array;
  };
  </code></pre>
  
  <p>&amp; I create func nummberOfColumns</p>
  <pre class="lang-js prettyprint-override"><code>let a = [];
  [...studentObject, ...createArray((5 -studentObject.length)].map((ele) =&gt; {
        a.push({
          id: ele.id,
          });
  });
  return a
  </code></pre>
  
  <p>then I use number Of Columns.map() to return the <code>&lt;/th&gt;</code> tag. In this tag I use onChange, but every time onChange the id changes to another id, I don't want that to happen. I tried using Usememo but it didn't work.</p>