This example shows how to build a form with react-hook-form that submits to a Gatsby Function.
-
Start developing.
To get started clone this repo locally and run
npm installto add all necessary packages.cd examples/functions-basic-form npm install npm run develop -
Open the code and start customizing!
Your site is now running at http://localhost:8000! You can use the UI on the index page to test the functions or directly access them at http://localhost:8000/api/form
Try editing the function in
src/api/form.tsor form atsrc/pages/index.js -
Deploy
You can deploy this example on Gatsby Cloud by copying the example into a new repo and connecting that to Gatsby Cloud.
- Add installation documentation to the README
- Update the
/apifolder with your function - Submit your theme at https://gatsbyjs.com/func-jam-21/
Read the Gatsby functions docs. Check out this video all about Gatsby functions Take a look at the Functions Use Cases over here.