Issue with form contact and Hooks

I am the maintainer of a gatsby starter gatsby-starter-i18n-bulma. It has a form to send an email message, recently i tried to “improve the code” transforming the code in a more modular way. I wanted to try to transform part of it into a functional component to be able to use Hooks. I was able to change the code, and the build was ok on the Netlify server, but when i try to test the form, i receive only empty mesages :sob:. What could be? Can you give me some advice? Does anybody tried this?

The contact form is in a template and the form contact itself is implemented in the ContactForm component.

Thank you in advance! :grinning:

Sounds like you may have trimmed a bit too much fat from the code here!

You’ll want to check out out forms debugging guide. I’ve linked to it below and it covers all of the common gotchas.

1 Like

i made these changes https://github.com/kalwalt/gatsby-starter-i18n-bulma/commit/cb34129e452f7887a77cc0a4c1195f26798faadd but still send empty messages

Hey @kalwalt :wave:t2:

Welcome to The Community :slight_smile:

For what it’s worth, I created a drop-in NPM package for integrating Netlify Forms into React-based SSGs (Next and Gatsby, really) that ‘just works’ - feel free to take a look through the source and see if your code matches up. Getting Forms to work just right can be tricky.

I also wrote a 2-pt series that goes through all the little nits and crannies :slight_smile:

Hopefully those help! If you run into any snags, let us know and we’ll be happy to help!


Jon

1 Like

Thank you @jonsully I will look at for sure :grinning:! But my form worked before. Probably some bad errors with hooks :smirk: :roll_eyes:

No problem! The source in that repo does use hooks (I pretty much only use hooks these days) so it may help!

I reverted to the old code for now, but in a near future i will use your plugin. Thank you! :grinning:

2 Likes