title: need something like event.target.focus() in React
body: <p>I'm creating a dynamic list component that basically renders a new empty text field every time something is added to the list. The component is as follows (it uses a custom TextFieldGroup but I don't think that code is necessary as nothing out of the ordinary is going on.):</p>
  
  <pre><code>const DynamicInputList = ({ inputs, onChangeArray, label, name, errors }) =&gt; 
  {
    const nonEmptyInputs = inputs.filter(input =&gt; {
      return input !== "";
    });
    const lastIndex = nonEmptyInputs.length;
    return (
      &lt;div&gt;
        {nonEmptyInputs.map((input, index) =&gt; {
          return (
            &lt;Grid container spacing={16} key={index}&gt;
              &lt;Grid item xs={12}&gt;
                &lt;TextFieldGroup
                  label={label}
                  id={`${name}${index}`}
                  name={name}
                  value={input}
                  onChange={e =&gt; onChangeArray(e, index)}
                  errors={errors[name]}
                /&gt;
              &lt;/Grid&gt;
            &lt;/Grid&gt;
          );
        })}
        &lt;Grid container spacing={16} key={lastIndex}&gt;
          &lt;Grid item xs={12}&gt;
            &lt;TextFieldGroup
              label={label}
              id={`${name}${lastIndex}`} 
              name={name}
              value={inputs[lastIndex]}
              onChange={e =&gt; onChangeArray(e, lastIndex)}
              errors={errors[name]}
            /&gt;
          &lt;/Grid&gt;
        &lt;/Grid&gt;
      &lt;/div&gt;
    );
  };
  </code></pre>
  
  <p>The onChangeArray function is as follows:</p>
  
  <pre><code>  onChangeArray = (e, index) =&gt; {
      const state = this.state[e.target.name];
      if (e.target.value === "") {
        state.splice(index, 1);
        this.setState({ [e.target.name]: state });
      } else {
        state.splice(index, 1, e.target.value);
        this.setState({ [e.target.name]: state });
      }
    };
  </code></pre>
  
  <p>Everything works fine except when a blank field is changed (begin to type) it immediately removes focus from any of the fields. I'm looking for a way to keep the focus on this field while still adding the new one below.</p>
  
  <p>Thanks in advance.</p>