title: In React hook, no e.target in handleChange with setValue()
body: <p>Since I'm learning how to build React forms with hooks, I went through the 3 quicks posts that culminate with <a href="https://medium.com/@grigorylapshin/and-even-more-forms-ab842a559d4b" rel="nofollow noreferrer">this one</a>. Everything is going well until I get to the last step when you create your custom hook with:</p>
  
  <pre><code>function useFormInput(initialValue) {
    const [value, setValue] = useState(initialValue);
  
    function handleChange(e) {
      setValue(e.target.value);
    }
  
    return {
      value,
      onChange: handleChange
    };
  }
  </code></pre>
  
  <p>The Input is:</p>
  
  <pre><code>const Input = ({ type, name, onChange, value, ...rest }) =&gt; (
      &lt;input
          name={name}
          type={type}
          value={value}
          onChange={event =&gt; {
              event.preventDefault();
              onChange(name, event.target.value);
          }}
          {...rest}
      /&gt;
  );
  </code></pre>
  
  <p>And the Form is:</p>
  
  <pre><code>const Form = () =&gt; {
    const email = useFormInput("");
    const password = useFormInput("");
  
    return (
      &lt;form
        onSubmit={e =&gt;
          e.preventDefault() || alert(email.value) || alert(password.value)
        }
      &gt;
        &lt;Input 
          name="email" 
          placeholder="e-mail" 
          type="email" 
          {...email} 
        /&gt;
        &lt;Input
          name="password"
          placeholder="password"
          type="password"
          {...password}
        /&gt;
        &lt;input type="submit" /&gt;
      &lt;/form&gt;
    );
  };
  </code></pre>
  
  <p>So in <code>useFormInput()</code> Chrome complains about </p>
  
  <blockquote>
    <p>TypeError: Cannot read property ‘value’ of undefined at handleChange</p>
  </blockquote>
  
  <p>which I'm pretty sure is pointing me to</p>
  
  <pre><code>function handleChange(e) {
    setValue(e.target.value);
  }
  </code></pre>
  
  <p>If I console.log(e) I get 'email', as expected (I think?), but if I try console.log(e.target) I get undefined. So obviously e.target.value doesn't exist. I can get it working by just using         </p>
  
  <pre><code>setValue(document.getElementsByName(e)[0].value);
  </code></pre>
  
  <p>but I don't know what kind of issues this might have. Is this a good idea? Are there drawbacks to getting it to work this way?</p>
  
  <p>Thanks</p>