I have a form that has a submit button. That form calls a function onclick that sets the state of something from false to true. I then want to pass this state back to the pa
Here is an example of how we can pass data from child to parent (I had the same issue and use come out with this )
On parent, I have a function (which I will call from a child with some data for it)
handleEdit(event, id){ //Fuction
event.preventDefault();
this.setState({ displayModal: true , responseMessage:'', resId:id, mode:'edit'});
}
dishData = this.handleEdit(event, id)}/>;
At the child component :
this.props.onEdit(event, listElement.id) }
className="btn btn-success">