How to use Botdetect Captcha from captcha.com in a React project with Typescript?

146 Views Asked by At

I want to use botdetect captcha from captcha.com in my React project. The problem is that we use Typescript instead of JavaScript and when I tried to create a react component from those famous 3 files my project shows multiple compilation errors:

reactjs-captcha.js
captcha-settings.js
captcha-helper.js

If we used Javascript instead of Typescript we had no issues. Another problem is that we used Function-based components instaed of class-based Components so "this" keyword in those files creates compilation errors. Also you know that the whole point of using those files as component is that you can call getInstance() method and after that getCaptchaId() method.

I read all the documentation but I didn't found any guides how to use it in React project with Typescript and also the sample project on captcha.com with typescript returns an angular module which I don't know how to convert it to a React component.

0

There are 0 best solutions below