In React ES6, why does the input field lose focus after typing a character?

前端 未结 10 2098
悲&欢浪女
悲&欢浪女 2020-12-08 12:54

In my component below, the input field loses focus after typing a character. While using Chrome\'s Inspector, it looks like the whole form is being re-rendered instead of ju

10条回答
  •  北海茫月
    2020-12-08 13:42

    set the correct id, make sure no other component has same id, set it unique, and it should not change on state update, most common mistake is updating the id with changed value on state update

提交回复
热议问题