I have 5 input fields rendered from an array, when I click on an plus-icon. Now, after I clicked that icon, I want to get a focus on the first of the input fields. How would I realise that? My idea was either with refs, but I don't know how to assign the ref to the first input field only. Or my second idea was, that I can access the input field by key or index somehow. But I don't know how to get the key or index property on the input field because that properties are not shown anywhere. They are also not accessible if I have a reference on the current input field.
actualState.inputFields.map((val,index) => (
<ListElemErrorBoundary key={index}>
<InputElement ref={focusInputOnClick}
key={index} elemValue = {val} name={"input" + index} onChangeListener={(event) => handleDoublettenIDs(event,index)} />
</ListElemErrorBoundary>
)
)