Question: In my react application, there is a part with entering the verification code. It looks like this:
[enter image description here](https://i.stack.imgur.com/5tw8I.png)

I want the focus to automatically switch to the next digit input field when entering the next digit. Right now I'm using DOM manipulation, but I want to find a more powerful solution.

my code right now:
<https://codesandbox.io/s/fast-shadow-vqojs2?file=/src/App.js>

I saw options for solving problems using Ref. But adding 5 refs is also not very good, in my humble opinion. Please advise something

Answer: 
I don't know if I get the problem right, but, you can basically set several types in your promise, I believe this could help?

Such a type would allow your array to contain several Promises of "different" types. You could eventually Promise.all on this entire array?

```
const promises: Promise<string | number>[] = [Promise.resolve('Lorem')]
if (someCondition) {
  promises.push(Promise.resolve(1))
}

```
This is a bug/feature that [has been fixed on TS 4.5](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#the-awaited-type-and-promise-improvements).