父级把"12"传递给子级
import React, { Component } from 'react';
class Ch extends React.Component{
constructor(...args){
super(...args)
}
render(){
return <div>{this.props.a}</div>
}
}
class Fa extends React.Component{
constructor(...args){
super(...args)
this.a=12
}
render(){
return <div><Ch a={this.a}/></div>
//令:父级.a=子级.props.a
}
}
export default Fa;