Hacker News new | past | comments | ask | show | jobs | submit login

> Today we know 2-way data binding is gimmicky and makes programs hard to debug. This is the reason React uses unidirectional data flow.

It makes sense for simple apps that are mainly rendering and outputting information/data.

Writing a React that handles even simple forms is however a trip back to the early days of web, where you gotta handle your own DOM events. I'm unclear when repeating the same DOM handlers all over the place became "easier to debug"




That’s because React isn’t a form library, it’s a rendering library. People have built form libraries on top of it. Here’s one I’ve used and contributed to that builds two-way binding for form state in React:

https://github.com/Shopify/quilt/blob/master/packages/react-...


Okay, but if React isn't going to handle forms for me, why am I wasting 100KB on it?


If you're going to use a "if React isn't going to handle X for me, why am I wasting 100KB on it?" argument, then it wouldn't be 100KB for very long, now would it?


Vue is smaller than React and does not need a form library.


Classic webdev reply. Hey how should I properly work with data binding and forms in react? npm install react-proper-use-of-binding-and-forms-duhhh!


There are libs that make it trivial, one is Formik.


It kinda feels like you're trading hard to debug data binding bugs, for hard to debug formik bugs.




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

Search: