I am working on a project in React and Sharetribe flex, and I am trying to make a Modal Popup when user Clickon button. Modal is opening for me but when I want to close it to "X" onCloseModal function is not closing my Modal. I wanted to know where the mistake lies, thanks in advance!!
export class EditListingAvailabilityFormComponent extends Component {
state = {
openModal: false,
};
onClickButton = e => {
e.preventDefault();
this.setState({ openModal: true});
};
onCloseModal = () => {enter code here
this.setState({ openModal: false});
};
<Button
onClick={this.onClickButton}
className={css.submitButton}
type="submit"
inProgress={submitInProgress}
disabled={submitDisabled}
ready={submitReady}
>
{saveActionMsg}
</Button>
<Modal open={this.state.openModal} onClose={this.onCloseModal}>
<h2> We would love to hear what you think! As we are constantly looking to improve
our processes we would love to hear from you how the listing & the onboarding
went! If you have 5 minutes to help us out we would be very grateful. Please
<a href="https://docs.google.com/forms/d/e/1FAIpQLScopkXx5GPFGrCpqKTBBNk4lUxzPaiVotAXIe_rlNN6oIIvBQ/viewform?usp=sf_link">
Click here
</a> here to proceed to the questionnaire.
</h2>
</Modal>