Natural Preference for Minification
    Wondering what’s next for npm?Check out our public roadmap! »

    react-google-recaptcha-v3-hook
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.9 • Public • Published

    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

    Install

    npm i react-google-recaptcha-v3-hook

    DownloadsWeekly Downloads

    149

    Version

    1.0.9

    License

    MIT

    Unpacked Size

    12.3 kB

    Total Files

    12

    Last publish

    Collaborators

    • avatar