title: why onChange event does not have event.keyCode property in react?
body: <p>I am trying to disable spaces in the input text field using <code>onChange</code> event and react-hooks. I'm saving the email input in state. The function in <code>onChange</code> event dispatches action, passing <code>e.target</code> as its input. However as soon as the dispatch occurs, the input field gets reset. I have tested the input field and it is working fine but when I click the keyboard space button then <code>event.keyCode</code> and event.which gives me undefined value.</p>
  
  <pre><code>import React, {useReducer} from 'react';
  
  const initialState = {
      email: ''
  };
  
  function reducer(state, action) {
      switch (action.type) {
          case 'email':
              return {
                  ...state,
                  email: action.payload
              };
          default:
              throw new Error();
      }
  }
  
  const Login = () =&gt; {
      const [state, dispatch] = useReducer(reducer, initialState);
      const handleChange = (event) =&gt; {
          if (event.keyCode == 32) {
              return false;
          }
          dispatch({ type: event.target.name, payload: event.target.value.trim() });
      }
      return (
          &lt;div className="container"&gt;
              &lt;input 
                  type="email"
                  name="email"
                  value={state.email}
                  onChange={handleChange}
                  placeholder="Enter Email"
              /&gt;
          &lt;/div&gt;
      )
  }
  
  export default Login;
  </code></pre>