React Recaptcha v3 Uncaught (в обещании) null - PullRequest
0 голосов
/ 06 июня 2019

Я пытаюсь использовать response-recaptcha-v3 (https://www.npmjs.com/package/react-recaptcha-v3), и я точно написал пример:

import React, { Component } from 'react';
import { ReCaptcha } from 'react-recaptcha-v3'
import { loadReCaptcha } from 'react-recaptcha-v3'

class ExampleComponent extends Component {

  verifyCallback = (recaptchaToken) => {
    // Here you will get the final recaptchaToken!!!  
    console.log(recaptchaToken, "<= your recaptcha token")
  }

  componentDidMount() {
    loadReCaptcha('site key (I can't give it here)')
  }

  render() {
    return (
      <div>

        <ReCaptcha
            sitekey="site key (I can't give it here)"
            action={console.log('action')}
            verifyCallback={this.verifyCallback}
        />

        <h2>Google ReCaptcha with React </h2>

        <code>
          1. Add <strong>your site key</strong> in the ReCaptcha component. <br/>
          2. Check <strong>console</strong> to see the token.
        </code>
      </div>
    );
  };
};

export default ExampleComponent;

Я написал свои доменные имена так:

  • 1009 * локальный *
  • локальный: 3000

И я получил ключ сайта и секретный ключ.

Вот что я получаю в консоли:

enter image description here

...