Skip to content

Docs: Adds React hooks alternative + code highlighting #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,20 @@ There are two steps that you need to implement.

This function should be imported and called in the main (parent) component of your app. We recommend calling it in `componentDidMount()` of `App.js`.

```
```js
import { loadReCaptcha } from 'react-recaptcha-v3'

...
// ...

componentDidMount() {
loadReCaptcha(your_site_key, callback);
}

// OR, with hooks

useEffect(() => {
loadReCaptcha(your_site_key, callback);
}, []);
```

### loadRecaptcha API
Expand All @@ -46,7 +52,7 @@ componentDidMount() {

Create a new component with the following code and give it a try!

```
```js
import React, { Component } from 'react';
import { ReCaptcha } from 'react-recaptcha-v3'

Expand Down Expand Up @@ -101,7 +107,7 @@ The ReCaptcha block can be triggered without a callback in order to trigger an a

See https://developers.google.com/recaptcha/docs/v3#Actions for more Information.

```
```js
<ReCaptcha
sitekey="your_site_key"
action='action_name'
Expand Down