@lalov1 you just make your child component "dumb", in the sense that both the data and the method to change that date comes from the parent, the child only purpose is to render the latter:
An example would be:
const child = ({value, onChange}) => (<div onClick={() => onChange()}>{value}</div>)
class Parent [...] {
state={value: 1}
onChange = () => this.setState({value: this.state.value +1})
render() {
return (<Child value={this.state.value} onChange={this.onChange} />)
}
}
hope it helps :+1:
:star2: 2472 | @darrenfj |http://www.freecodecamp.org/darrenfj
:star2: 4792 | @masd925 |http://www.freecodecamp.org/masd925
eval
:imp:
:cookie: 16 | @hansuno2 |http://www.freecodecamp.org/hansuno2