1.2.3 • Published 3 years ago

react-recaptcha-hook v1.2.3

Weekly downloads
713
License
MIT
Repository
github
Last release
3 years ago

react-recaptcha-hook

React hook for google-recaptcha v3

Install

// with npm
npm install react-recaptcha-hook

// with yarn
yarn add react-recaptcha-hook

How to use

import React, { useEffect } from 'react';
import { useRecaptcha, Badge } from 'react-recaptcha-hook';

const RecaptchaComponent = ({ action, sitekey, onToken }) => {
  const execute = useRecaptcha({ sitekey, hideDefaultBadge: true });

  useEffect(() => {
    const getToken = async () => {
      const token = await execute(action);
      onToken(token);
    };

    getToken();
  }, []);

  return <Badge />;
};

export default RecaptchaComponent;

Server side validation

License

MIT

1.2.3

3 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago