Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经为许多类似的案例尝试了几种做法,但没有一个适用于我的案例。输入一个字母后,表格的输入总是失去焦点。如何避免?
我在代码sandbox.io 的片段中提供了一个代码
链接:https ://codesandbox.io/s/84wm4v4099
问题在于每次调用 render 时您的键都会触发元素的完整重新渲染。试试这个:
return ( <PTDR key={`input${idx}`}> <InputTable...
请参阅此处的工作示例