I am planning to build a Drupal 8 site fully decoupled using Gatsby (a site generator for React). So I will use Drupal only to structure (content types, paragraphs), enter and update all the content and data and use React for the frontend.

The website also needs a (simple) form. I want to use the webform module for this.

But how do you get a Drupal form in React and after submitting send all completed fields to the database?

  • I guess it depends on you. Will you use GraphQL or JSON:API? Then you need to set up Drupal to expose the corresponding endpoints the way React needs it. – leymannx May 22 at 7:36
  • @leymannx I wil use JSON:API to create all endpoints in Drupal. Then with GraphQL I will query all my Drupal fields and data into my Gatsby (React) project using gatsby-source-drupal – meez May 22 at 8:23
  • 3
    Asking for tutorials or modules is off-topic, but you should check the available webform extentions drupal.org/docs/8/modules/webform/webform-add-ons – 4k4 May 22 at 8:49
  • 1
    If the website only needs a (simple) form. I would recommend first exploring using core's contact.module with drupal.org/project/contact_storage. Because the contact.module uses Field API it could be a simpler solution. – jrockowitz May 22 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.