onKeyPress={(e) => !/[0-9]/.test(e.key) && e.preventDefault()} // numbers only onKeyPress={(e) => !/[a-zA-z]/.test(e.key) && e.preventDefault()} // alphabets only.