title: How fix input and state in react?
body: <p>Have</p>
  <pre><code>const [grade, setGrade] = useState({grade: null,})
  
  const changeHandler = (event) =&gt; {if (event.value) {setGrade({ ...grade, [event.name]: event.value })} else {setGrade({ ...grade, [event.target.name]: event.target.value })}}
  </code></pre>
  <p>and input</p>
  <pre><code>&lt;input
                    type=&quot;text&quot;
                    name=&quot;grade&quot;
                    className=&quot;homework-block-main-input&quot;
                    onClick={changeHandler}
                    /&gt;
  </code></pre>
  <p>when i print value in input i have</p>
  <p>print &quot;1&quot;
  have &quot;&quot;
  print &quot;12&quot;
  have &quot;1&quot;
  print &quot;123&quot;
  have &quot;12&quot;</p>
  <p>How to fix that?</p>
  <p>when i print value in input i have</p>
  <p>print &quot;1&quot;
  have &quot;&quot;
  print &quot;12&quot;
  have &quot;1&quot;
  print &quot;123&quot;
  have &quot;12&quot;</p>
  <p>How to fix that?</p>