JSFiddle - React, Tailwind, and code Playground

HTML

<form action="">
  <input type="text">
</form>

JavaScript

document.querySelector('form').oninput = function(e) {
	var maxLength = 10
  
  if (e.target.value.length >= maxLength) {
  	const nextInput = document.createElement('input')
    this.appendChild(nextInput)
    nextInput.focus()
  }
  
  if (e.target.value.length === 0) {
  	e.target.previousElementSibling.focus()
  	this.removeChild(e.target)
  }
}