Home » Ask (Forum) » How to Create WP-REST-API Contact form with REACT


I’m making a site with wp-rest-api and react, and i need a contact form on it. I found, on the WP-REST-API docs, that the CUSTOM CONTACT FORMS have some integration with the API. But i’ve have try to search a lot for some examples or reference to get the forms via REST for displaying with react, but i didn’t found anything… Can someone help me with that?

Aug 24, 2016 (2 years ago) - Posted by 2 Comments

2 Answers

  1. Mr Smith says:

    You can call you post api on click of submit button under your component. So do necessary validations on input and on submit click call a function say _handleClick() and in that function send post call with you data.

    class x extends React.Component {
        // post api call
        //confirmation message
              //your form inputs
               <button type="submit" onClick={this._handleClick.bind(this)}>Submit</button>
    Unregister Member
  2. Gunawan says:

    Thanks Mr Smith 🙂

    Register Member

Your Answer

Your email address will not be published. Required fields are marked *