← Back to context

Comment by jakelazaroff

5 years ago

Is it surprising that two-way data binding is a source of bugs? We learned that lesson from Angular, and it influenced React’s preference for one-way dataflow.

2-way data binding is still a useful pattern with discipline, and still also common in React (using event handlers).

  • Any error-prone pattern can remain useful with enough discipline, but we've learned time and time again that relying solely on discipline to cover for error-prone patterns doesn't scale.

    • Define "we". :) I understand this sentiment though, and I also understand designing a flexible system with zero footguns is nigh impossible. My point however was that two-way databinding is not rare in React, and there are other potential footguns to be had in idiomatic React anyway (hooks, React Context).

      2 replies →

  • It's never two-way in react. You're always in charge of updating the state in the event handler, which means you know where the update came from

What do you mean by two-way and one-way exactly? (Asking it because web sometimes has a different history for terms.)