Component A
this.state = {
x: 1,
y: 2
}
reset () {
this.setState ({
x: 3,
y: 5
})
}
render () {
<B x = {this.state.x} y = {this.state.y} onClick = {this.reset.bind(this)}/>
}
========================================================
Component B
this.state = {
z: someMethod()
}
someMethod () {
return this.props.x + this.props.y
}
On Click , I am invoking reset Method and updating the state of Component A but how to re render the component B. Now its not updating component B.
Tried with
componentWillReceiveProps (nextProps) {
this.constructor(nextProps)
}