title: The object empty check is not working and changing the logic
body: <p>So I am doing a form validation check and I have taken 'formErrors' and set the errors in this object. However it is initially {} and in my code I am checking for Object.keys(formErrors).length===0 which returns true for even {}</p>
  <pre><code>
    const [formValues, setFormValues] = useState(initialValues);
    const [formErrors, setFormErrors] = useState({});
  
    const handleChange = (e) =&gt; {
      const { name, value } = e.target;
      setFormValues({ ...formValues, [name]: value });
    };
  
    const url = '/collectdetails';
  
    const handleSubmit = (e) =&gt; {
      e.preventDefault();
      setFormErrors(validate(formValues));
      // setIsSubmit(true);
      console.log(noErrors);
      if (noErrors) {
        const { fullName, phoneNumber, emailAddress, role, lookingFor, company } =
          formValues;
        const data = {
          Name: fullName,
          MobileNumber: phoneNumber,
          Email: emailAddress,
          Role: role,
          LookingFor: lookingFor,
          CompanyName: company,
        };
  
        getDetails(url, data).then((user) =&gt; {
          const { Response } = user;
  
          if (Response === 'OK') {
            setCurrentUser(phoneNumber);
            navigate('/');
          }
        });
      }
    };
  
    useEffect(() =&gt; {
      if (Object.keys(formErrors).length === 0) {
        console.log(formErrors);
        setNoErrors(true);
      }
    }, [formErrors]);
  
    
  </code></pre>
  <p>So When I submit the handleSubmit() method is run and it has 2 nested checks. The first one is for noErrors which is a bool state that checks if my object is empty. I have console logged it and it returns true when the component loads as the object is {} in the beginning. Is there any way for me to put a check so that I can see if there are some keys present in the object?</p>