Gravity Forms

Has anyone managed to successfully use React Gravity Forms (https://www.npmjs.com/package/react-gravity-form)? I get an error: “ReferenceError: regeneratorRuntime is not defined”

Now that I know I can tackle ACF/repeater fields, the only remaining hurdle for me is Gravity forms. I saw a thread Contact Forms like contact form 7 on CF7, which would not be quite the same.

BTW, thank you to the devs working on this project, I have been neglecting to get on board the React train because of my clients all being on the WP platform, but this is a serious game-changer.

I unfortunately can’t be of much help since I have not tried React Gravity Forms, but I was having an issue with React Fabric and the was because Frontity uses SSR (Server Side Rendering). I can’t confirm that is the issue that you are running into since I don’t have enough information. That being said, I hope it helps you troubleshoot it. Someone from Frontity will probably respond with more details soon :blush:

3 Likes

I didn’t know there was a React component for Gravity Forms. That’s quite interesting. Then creating a Frontity package should be fairly easy :slight_smile:

That’s because the transpiled version (its dist folder), expects @babel/polyfill. One way to solve could be installing it and requiring it in your code:

> npm install @babel/polyfill
import "@babel/polyfill";
import GravityForm from "react-gravity-form";

But that will add unnecessary Kbs to your bundle.

Frontity is able to transpile libraries from node_modules, so my recommendation is to use their non-transpiled code (its src folder) and let Frontity deal with the transpilation.

import GravityForm from "react-gravity-form/src";

Let me know if that works.

1 Like

Thank you, I will give that a try! I did get this to work on a vanilla react site, but realized the default endpoint in the plugin documentation is incorrect. Gravity forms requires Authentication for its REST endpoints, even to read the forms, and https://www.npmjs.com/package/react-gravity-form does not provide options for a key/secret field. I was able to get it working by creating a custom endpoint in WP and then changing the url to the custom one.