2017.11.30 Reat Data interaction of the front and back of the button commit processing (AJAX methods are packaged separately as APIs without a form)

Source: Internet
Author: User

1. Button definition:

2. Introducing an external JS file (a file that encapsulates the Ajax method): Note The directory structure

3. Invoke the specific method in the Ajax file:

4. Writing syntax for methods in AJAX files:

Writing one:

Two:

Two corresponding calls to the method's notation:

# #var Mongoose = Module.exports = exports = new Mongoose;

The difference between export, import and export default in 5.ES6:

Export and export default can be used for exporting constants, functions, files, modules, etc., you can import them in other files or modules by import+ (constant | function | file | module) name, so that they can be used, but in a file or module, Export, import can have multiple, export default only one.

6. Key step: React gets the data for the page Dom (Input):

(1) Button binding event:

(2) Bind different onchange functions to different input boxes:

(3) To write different input boxes corresponding to the different state change function, the purpose is to different input boxes corresponding to different parameters:

(4) The event function that submits the button binding can invoke different state parameters:

2017.11.30 Reat Data interaction of the front and back of the button commit processing (AJAX methods are packaged separately as APIs without a form)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.