title: Cannot read property 'value' of null in ReactJS
body: <p>I've been trying to console.log these 2 inputs, but can't seem to figure it out, can anyone tell me what I've done wrong?
  I keep getting the <strong>Cannot read property 'value' of null</strong> error</p>
  
  <pre><code>function printInputs() {
    let username = document.getElementById('user').value
    let password = document.getElementById('pass').value
  
    console.log(username);
    console.log(password);
  
  }
  
  function App() {
  
    return (
      &lt;div className="App"&gt;
        &lt;h1&gt;Log In&lt;/h1&gt;
        &lt;h1&gt;{code}&lt;/h1&gt;
        &lt;form&gt;
          &lt;input className='userInput' id='user' type='text' placeholder='username' /&gt;&lt;br /&gt;
          &lt;input className='userInput' id='pass' type='password' placeholder='password' /&gt;&lt;br /&gt;
          &lt;input className='userSubmit' type='submit' value='Log In' onSubmit={printInputs()} /&gt;
        &lt;/form&gt;
      &lt;/div&gt;
    );
  }
  </code></pre>