module.exports= class APP extends React.Component {
constructor(props){
super(props);
this.state = {
key1:\'key1\',
key2:\'key2\'
};
rend
class Parent extends Component{
constructor(props){
super(props);
this.state={value:''};
this.getData=this.getData.bind(this);
}
getData(val){
console.log(val);
this.setState({
value:val
});
}
render(){
const {value}=this.state
return(
{this.state.value};
)
}
}
export default Parent;
CHILD CLASS:
class Child extends Component{
componentWillMount(){
this.props.sendData('data');
}
render(){
return(
)
}
}
export default Child;