title: Cannot convert undefined or null to object or not length
body: <p>If you put a value in every input, it works normally. However, errors appear even if only one input is empty.
  nameValue.length, an error appears that you cannot work on the length.
  Object.values(nameValue).length, the error  'Cannot convert undefined or null to object' appears.</p>
  <pre class="lang-js prettyprint-override"><code>const [values, setValues] = useState({
      nameValue: '',
      numberValue: '',
      contentValue: '',
    });
  
    const { nameValue, numberValue, contentValue } = values;
  
    const handleNumber = e =&gt; {
      const { value, name } = e.target;
  
      setValues({
        ...values,
        [name]: value,
      });
    };
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>useEffect(() =&gt; {
      if (numberValue.length === 11) {
        setValues({
          numberValue: numberValue.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3'),
        });
      } else if (numberValue.length === 13) {
        setValues({
          numberValue: numberValue
            .replace(/-/g, '')
            .replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3'),
        });
      }
    }, [numberValue]);
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>const handleSend = e =&gt; {
      e.preventDefault();
      //console.log(typeof stringify(nameValue) === 'undefined');
  
      const nameValueTrue =
        Object.values(nameValue).length &gt; 4 ||
        Object.values(nameValue).length &lt; 1 ||
        typeof nameValue !== 'string' ||
        typeof nameValue === 'undefined';
  
      const numberValueTrue =
        Object.values(numberValue).length &lt; 13 ||
        Object.values(numberValue).length &gt; 14;
  
      const contentValueTrue =
        typeof contentValue !== 'string' ||
        Object.values(contentValue).length &lt; 2;
  
      const error = !e.target.value;
  
      if (nameValueTrue) {
        alert('이름을 확인해주세요.');
        console.log('name안');
      } else if (numberValueTrue) {
        console.log('number');
        alert('휴대폰번호를 확인해주세요.');
      } else if (contentValueTrue) {
        console.log('content');
        alert('내용을 확인해주세요.');
      } else {
        goto();
      }
    };
  </code></pre>
  <pre class="lang-js prettyprint-override"><code>&lt;ContentBox&gt;
            &lt;div&gt;Name&lt;/div&gt;
            &lt;ContentInput
              name=&quot;nameValue&quot;
              value={nameValue || undefined}
              //value={nameValue || ''}
              //value={nameValue}
              onChange={handleNumber}
            /&gt;
          &lt;/ContentBox&gt;
          &lt;ContentBox&gt;
            &lt;div&gt;Phone Number&lt;/div&gt;
            &lt;ContentInput
              name=&quot;numberValue&quot;
              value={numberValue || undefined}
              //value={numberValue || ''}
              //value={numberValue}
              onChange={handleNumber}
            /&gt;
          &lt;/ContentBox&gt;
          &lt;ContentBox&gt;
            &lt;div&gt;Content&lt;/div&gt;
            &lt;ContentInput
              placeholder=&quot;내용 입력.&quot;
              name=&quot;contentValue&quot;
              value={contentValue || undefined}
              //value={contentValue || ''}
              //value={contentValue}
              onChange={handleNumber}
            /&gt;
          &lt;/ContentBox&gt;
          &lt;Submit onClick={handleSend}&gt;Send&lt;/Submit&gt;
  </code></pre>