0

I'm doing a project in React with Typescript and I have the problem "Uncaught ReferenceError: grecaptcha is not defined". I searched for alternative solutions but found nothing effective yet. My unsuccessful solution attempt: I installed grecaptcha (npm install --save @types/grecaptcha), however the problem remains.

const handleQuery = () => {
    if (id === "upload-file" && sendFileFlag) {
      // @ts-ignore
      const selectedFile = generalRegister.file[0];

      grecaptcha.ready(function () {
        grecaptcha
          .execute(
            "https://SITE_KEY",
            { action: "submit" }
          )
          .then(function (token: string) {
            submitFile(selectedFile, token);
          });
      });
  
    }
  };
```
devvvvv
  • 25
  • 4

0 Answers0