title: React state hook with an object
body: <pre><code>const App = () =&gt; {
    const [User, setUser] = useState({
      id: 1,
      name: "ed",
      age: Number,
      edit: false
    });
    return (
      &lt;div&gt;
        &lt;input value={User.name} onChange={e =&gt; setUser.name(e.target.value)} /&gt;
      &lt;/div&gt;
    );
  };
  </code></pre>
  
  <p>I am working with react hooks. I set the initial state to an object. I try changing the value with react hooks but this gives an error <code>TypeError: setUser.name is not a function</code></p>