# react-recaptcha-hook

> React hook for google-recaptcha v3

Latest version **1.2.3** (published 2022-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-recaptcha-hook
pnpm add react-recaptcha-hook
yarn add react-recaptcha-hook
bun add react-recaptcha-hook
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2022-06-28 |
| First published | 2019-06-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 25 |
| Maintainers | hupe1980 |
| Keywords | react, hook, google, recaptcha, grecaptcha, v3 |

## Links

- npm: https://www.npmjs.com/package/react-recaptcha-hook
- Repository: https://github.com/hupe1980/react-recaptcha-hook
- Homepage: https://github.com/hupe1980/react-recaptcha-hook#readme
- Issues: https://github.com/hupe1980/react-recaptcha-hook/issues
- npm.io page: https://npm.io/package/react-recaptcha-hook

## Dependencies (1)

- [react-script-hook](https://npm.io/package/react-script-hook.md) ^1.2.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.3 (latest) — 2022-06-28
- 1.2.2 — 2021-04-21
- 1.2.1 — 2021-04-15
- 1.2.0 — 2021-01-22
- 1.1.1 — 2020-02-21
- 1.1.0 — 2020-02-21
- 1.0.9 — 2019-12-28
- 1.0.8 — 2019-07-21
- 1.0.7 — 2019-06-17
- 1.0.6 — 2019-06-17
- 1.0.5 — 2019-06-17
- 1.0.4 — 2019-06-17
- 1.0.3 — 2019-06-17
- 1.0.2 — 2019-06-16
- 1.0.1 — 2019-06-16
- … 1 more at https://npm.io/package/react-recaptcha-hook/versions

## README

# react-recaptcha-hook

> React hook for [google-recaptcha v3](https://developers.google.com/recaptcha/docs/v3)

## Install

```sh
// with npm
npm install react-recaptcha-hook

// with yarn
yarn add react-recaptcha-hook
```

## How to use

```javascript
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

- [Verify the User's Response](https://developers.google.com/recaptcha/docs/verify)
- [Domain/Package Name Validation](https://developers.google.com/recaptcha/docs/domain_validation)

## License

[MIT](LICENSE)

---
_Source: https://npm.io/package/react-recaptcha-hook · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
