1.0.2 • Published 4 years ago

react-google-recaptcha-hooks v1.0.2

Weekly downloads
36
License
MIT
Repository
github
Last release
4 years ago

react-google-recaptcha-hooks

Made with create-react-library

NPM JavaScript Style Guide

Install

npm install --save react-google-recaptcha-hooks

Usage

import React from 'react'
import { useGoogleReCaptchaV2 } from 'react-google-recaptcha-hooks'

const App = () => {
  const {
    ReCaptchaBadge,
    executeReCaptcha,
    resetReCaptcha
  } = useGoogleReCaptchaV2({
    siteKey: '',
    language: 'en'
  })

  const handleClick = async () => {
    const token = await executeReCaptcha()

    setTimeout(() => {
      resetReCaptcha()
    }, 3000)
  }
  return (
    <div>
        {ReCaptchaBadge}

        <button onClick={handleClick}>Click</button>
    </div>
  )
}

export default App

License

MIT © armspkt