title: Need auto separator in input field while typing in react.js
body: <p>I need a number input field which only limits 13 each. After the first 5 numbers it separates auto-fill '-' and then the next 13 will be the same.</p>
  
  <p>input state: <code>const [num, handleNum] = useState('')</code></p>
  
  <p>I wrote this function but when I remove the number after the separator, It can’t be deleted.</p>
  
  <pre><code>const handleAutoFilling = val =&gt; {
          handleNum(val)
  
          if (val.length === 5 || val.length === 13) {
              handleNum(`${val}-`)
          }
      }
  </code></pre>
  
  <pre><code>&lt;Input placeholder='CNIC' inputType='text'
      onChange={value =&gt; handleAutoFilling(value)}
      value={num}
  /&gt;
  </code></pre>