title: React Class to Function components
body: <p>I'm on the step of converting one of my Class components to a functional one, however, I'm thinking of better way of handling state from the functional version.</p>
  <p>Currently, here is my Class component state:</p>
  <pre><code>this.state = {
        email: &quot;&quot;,
        password: &quot;&quot;,
        errors: {},
      };
  </code></pre>
  <p>On functional component version ,Currently I would have to break those states into three different states using UseState:</p>
  <pre><code>const [email, setEmail] = useState(&quot;&quot;);
  const [password, setpassword] = useState(&quot;&quot;);
  const [errors, setErrors] = useState({});
  </code></pre>
  <p>is there a way to combine these states in 1 state that is an object by default like this:</p>
  <pre><code>const [states,setStates] = useState({
      email:&quot;&quot;,
      password:&quot;&quot;,
      errors:{}
  });
  </code></pre>
  <p>Reason why is because I have this kind of code from my class components, and I dont think this will work if I opted for the first Functional comp. setup:</p>
  <pre><code>  handleChange = (event) =&gt; {
      this.setState({
        [event.target.name]: event.target.value,
      });
    };
  </code></pre>