Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

330
Views
How to close a modal using class components in React and Sharetribe flex

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>   
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!