Why is there no double-bound api? like v-model and ng-model in React?

I think one-way data flow and two-way data binding for the form do not conflict. If you encounter a complex form, if you do not use a third-party library, you can only use state plus event monitoring processing, which is a bit troublesome.

Mar.20,2021

v-model is syntactic sugar, you can write a high-level component to implement. React is an one-way data flow, so the data flow is more controllable and clear, in addition, that is the controlled component


because the design idea is one-way.
as for the form you mentioned.
it's convenient to use UI frameworks, such as ant-design, and you can learn about the specific use of the form components.
http://ant.design/components/.
without the help of third-party libraries, native js can get form values according to name when submitting forms, which should solve your problem.


when we encounter this problem, we usually say that the design idea of React is one-way data flow. I think we can understand why there is no two-way data binding:

first of all, what is React ? Pure View layer; what is AngularJS ? A complete front-end JS framework.
then, what are the requirements for two-way data binding for React?-- obviously business requirements. Because unidirectional data streams already meet the requirements of View layer rendering and are easier to test and control (from Props or State), why do you need bidirectional data binding in pure React?

if you need to solve the problem of two-way data binding, you can use a third-party library such as Ant Design's rc-form, or you can store it in State or even Redux, according to your needs.

so React's lack of two-way data binding is not a lack of functionality or conflict, but rather that React focuses on solving a pure problem: the View layer. To paraphrase Zhang Xiaolong's sentence: it shows that pure success can be achieved:)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38050-2b928.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38050-2b928.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?