title: React useRef with Array for dynamic
body: <p>I am trying to make the component that the focus moves to the next input when each letter inputted.</p>
  
  <p>I think I need multiple <code>ref</code> like an array but I don't know about it.</p>
  
  <p>It's a sample code for the question.</p>
  
  <pre><code>function PIN({length, onChange, value}){
    const inputEl = React.useRef(null);
    function handleChange(e){
      onChange(e);
      inputEl.current.focus(); 
    }
    return (
      &lt;div&gt;
        {
          new Array(length).fill(0).map((i)=&gt;(
            &lt;input type="text" ref={inputEl} onChange={handleChange} /&gt;
          ))
        }
      &lt;/div&gt;
    )
  }
  </code></pre>