UNPKG

react-recaptcha-v3

Version:

This library helps to integrate google recaptcha into your react project easily.

39 lines (31 loc) 864 B
import React, { Component } from 'react' import { ReCaptcha, loadReCaptcha } from 'react-recaptcha-v3' const verifyCallback = token => { // Here you will get the final token!!! console.log(token, 'verifycallback') } class Example extends Component { componentDidMount () { loadReCaptcha('your_site_key') } render () { return ( <div> <ReCaptcha action='main' sitekey='your_recapcha_key' verifyCallback={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> <header> <h1>Thanks for using `react-recaptcha-google`</h1> </header> </div> ) } } export default Example