score:2

Accepted answer

when you update a state in parent component it will not reflect in child components until you use componentwillreceiveprops(props).

bascially componentwillreceiveprops(props) keeps track whenever the state is changed.

so when you do

 <deletemodal rowid={this.state.rowid} deletehandler={this.deletehandler} />

this will only bind state which were set at initial render().

solution

in you modal class create a method of react lifecycle as

componentwillreceiveprops(props){
   console.log(props.rowid) //this will get whenever state changes after initial render
}

see more on componentwillreceiveprops()

score:1

you just pass those states as props to the child component:

<somechildcomponent someproperty={this.state.somestate} />

then the child component will receive the updated props (this.props.someproperty) automatically when the state in parent changes.


Related Query

More Query from same tag