I am just writing to text input and in onChange
event i call setState
, so React rerenders my UI. The problem is that the text input always lose a f
Applying the autoFocus
attribute to the input
element can perform as a workaround in situations where there's only one input that needs to be focused. In that case a key
attribute would be unnecessary because it's just one element and furthermore you wouldn't have to worry about breaking the input
element into its own component to avoid losing focus on re-render of main component.