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
onChange
setState
Simple solution in my case:
ref && ref.focus()} onFocus={(e)=>e.currentTarget.setSelectionRange(e.currentTarget.value.length, e.currentTarget.value.length)} />
ref triggers focus, and that triggers onFocus to calculate the end and set the cursor accordingly.
ref
onFocus