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.
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.
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:)
Previous: How to configure multiple reverse proxies for vue
Next: Js dom operation Click current Show Click other Hidden?
use antd components first import {xxx} from antd is there any way to register components globally at the entrance so that you don t have to import every time ...
how does it mean that return {} is an object, and then a comma separates two? Don t understand the meaning of the book ...
react project created based on creat-react-app,. In order to solve the compatibility of IE with some methods of Es6, babel-polyfill is introduced into the project. Can run normally in the local development environment, performing packaging upload to th...
We have a project that was originally developed in react-native. Now we want to move this project to the h5 version of the web page. We use the react-naitve-web library. the process of building a project is to first create app, with react-create-app s...
use the form component of antd, the form element limit is required, and the form has the function of uploading attachments. I call an interface with ajax and assemble data including attachments with FormData. At this time, you need to set the parameter ...
problem description in componentDidMount, document.getElementById ( id ) is null the environmental background of the problems and what methods you have tried I try to use ref, to find undefined. in this.refs related codes componentDidMount() ...
during the interview, I encountered the following questions is tested correctly in the test environment, and a blank page appears in the formal environment. Because it is packaged in a framework, the code is compressed and breakpoints cannot be used ...
come straight to the point first import components App : nothing but layouts (components of antd), then I add three Link for click testing, a custom DDD component BBB< Link> < h3> <DDD> 1111111...
problem description restful development mode, however, when the front end gets the data sent from the server, many of them do not give default values, and many of them are caused by null, such as the string .toString (), length, and so on. if each fi...
run Can only set one of children or props.dangerouslySetInnerHTML after pulling the branch. there is no content in using dangerouslySetInnerHTML after global search. Solve ...
during the interview, you will ask how to structure your front-end project my answer is first of all, I will say that the technologies I use are react family bucket webpack and es6 then I will say that I will put each page in a separate folder e...
if you want to assign a variable, you can only require let shapeBack = require( . public img shapeBack.png ); then introduce into the source in the Image component but before, when we wrote react to import pictures, we used import,rn but not impor...
the following figure shows the content that appears when searching my personal website. Why is there only a loading? I have already set up keywords and description, why it doesn t work? my website is made of react and has been deployed for onl...
some repeated lists with some changes show whether it is feasible for simple interactive operation pages to be generated by dragging and dropping, and whether there is a running system to share ideas. ...