module.exports= class APP extends React.Component {
constructor(props){
super(props);
this.state = {
key1:\'key1\',
key2:\'key2\'
};
rend
You need to pass from parent to child callback function, and then call it in the child.
For example:
class Parent extends React.Component {
constructor(props){
super(props);
this.state = {
show: false
};
}
updateState = () => {
this.setState({
show: !this.state.show
});
}
render() {
return (
);
}
}
class Child extends React.Component {
handleClick = () => {
this.props.updateState();
}
render() {
return (
);
}
}