Styled components | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Styled components

Why input loose focus when i use onChange with styled components in react

28th Dec 2021, 6:21 AM
EsaKurniawan
1 Resposta
0
This happens because you've defined Input within the render() method. Every time the state gets updated, the render() method will be called and Input will be redefined and handled as if it was a completely new component (a html <input/> without focus in this case). https://stackoverflow.com/questions/57096907/styled-component-input-loses-focus-onchange https://pretagteam.com/question/styled-component-input-loses-focus-onchange
3rd Jan 2022, 3:40 AM
NEZ
NEZ - avatar