Introduction [react] --- traditional values of components

 

First, father to son

Father to son 

        when the sub-assembly for use as tags within parent components when the custom properties by binding the traditional values, 
        received by the time receiving this.props internal subassembly (Any external data is received by props) 
        

        defined default external data 
            components .defaultProps = { 
                Key: Val 
            } 
 
        types of external data definitions
             . 1, the install CNPM prop-types - S

             2, is introduced from PropTypes Import "prop-types" ;

             . 3 , using 
                components .propTypes = { 
                    Key: type 
                }

 

 

 

 

 

 

 

Second, the father of the child pass

 

    A parent child transmission 
        when the sub-assembly for use as a label in the parent component when bound to the current sub-assembly a custom attribute, a value for the function parameter is received 

        inside the subassembly by triggering this.props. Attribute name () to traditional values

 

 

 

Guess you like

Origin www.cnblogs.com/yuanjili666/p/11570187.html