React Study Notes 4

Source: Internet
Author: User

problems encountered

At present, the template is self-defined, the style is not good control in the component design, you can put the page data display place, split parent-child component nested structure, for example, the product data display list, the group of the outer container as a parent component, which is the data display of the rendering template, as a sub-component

 Do data interaction

1. Implementing the separation of parent-child components---Parent component request data, sub-component parsing

2. Implementation in the parent component, the life cycle function in the request Ajax, the data is obtained, the parent component of the state, and then pass the state to the props of the child component

3. Parsing and printing data in subcomponents

4. Control the overlay of the subassembly in the parent component, and finally render the overlay result to the page through the parent component

 mixins

Mixins is a property provided in the React component

In the development of many functions (JS function composed of modules) there is commonality, the public function extraction, through the mixins to use

First, the public functions are extracted and placed in an object, which are extracted from the type of the object method.

Use: To mount the methods in the Commonapis object to the component's prototype chain by Mixins:[commonapis] in the component that calls the public method.

If you use these methods in your component, you need only onchange={this.checkinput}.

React Study Notes 4

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.