Dear All,
Anyone, please help me with the below query...
I have initialized the state value and send it to the parent component and using the onClick event I am updating the state value, and that update state value not able to pass the parent component.
//Initalizing the state
state = {
itemId: data[0].id
}
// onclick event and to Updating state
handleclick = (id) => {
this.setState({itemId: id})
}
//Button Onclick
onClick={()=>{this.handleclick(data.id)}}>{data.Datavalue}
// Sending to the (Table)Parent component
// Table itemid={itemId}
Please help me, someone to resolve this.
Below screenshots for reference.
https://dev-to-uploads.s3.amazonaws.com/i/yajky99vtosf7j5qix6n.JPG
Thanks.
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.