Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"Look how quickly it can render the component 50 times!"




"Look, it can render the whole app really quickly every time the user presses a key!"

That gets into a very interesting question of controlled vs. uncontrolled components.

On one hand I like controlled components because there is a single source of truth for the data (a useState()) somewhere in the app, but you are forced to re-render for each keypress. With uncontrolled components on the other hand, there's the possible anarchy of having state in React and in the actual form.

I really like this library

https://react-hook-form.com/

which has a rational answer to the problems that turn up with uncontrolled forms.


That's neat, thanks for the link!



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: