Skip to content

Commit

Permalink
[added] doc for react 0.14 + old 0.13
Browse files Browse the repository at this point in the history
- also added the version for google ReCaptcha (v2) closes dozoisch#4
  • Loading branch information
dozoisch committed Oct 15, 2015
1 parent 0ac46e9 commit dfa9bf2
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@
[![Dependencies][deps.img]][deps.url]
[![Dev Dependencies][devdeps.img]][devdeps.url]

Component wrapper for [Google reCAPTCHA][reCAPTCHA]
Component wrapper for [Google reCAPTCHA v2][reCAPTCHA]

## Installation

```shell
npm install --save react-google-recaptcha
```

### React 0.13
With 0.13, install version 0.4.0
```shell
npm install --save [email protected]
```

## Usage

All you need to do is [sign up for an API key pair][signup]. You will need the client key.
Expand All @@ -21,18 +27,21 @@ You can then use the reCAPTCHA. The default require, imports a wrapped component

```jsx
var React = require("react");
var render = require("react-dom").render
var ReCAPTCHA = require("react-google-recaptcha");

function onChange(value) {
console.log("Captcha value:", value);
}

React.render(
<ReCAPTCHA
ref="recaptcha"
sitekey="Your client site key"
onChange={onChange}
/>, document.body);
render(
<ReCAPTCHA
ref="recaptcha"
sitekey="Your client site key"
onChange={onChange}
/>,
document.body
);
```

### Rendering Props
Expand Down Expand Up @@ -61,6 +70,7 @@ You can also use the barebone components doing the following. Using that compone

```jsx
var React = require("react");
var render = require("react-dom").render
var ReCAPTCHA = require("react-google-recaptcha/lib/recaptcha");

var grecaptchaObject = grecaptcha // You must provide access to the google grecaptcha object.
Expand All @@ -69,24 +79,17 @@ function onChange(value) {
console.log("Captcha value:", value);
}

React.render(
<ReCAPTCHA
ref="recaptcha"
sitekey="Your client site key"
onChange={onChange}
grecaptcha={grecaptchaObject}
/>, document.body);
render(
<ReCAPTCHA
ref="recaptcha"
sitekey="Your client site key"
onChange={onChange}
grecaptcha={grecaptchaObject}
/>,
document.body
);
```



## To Come Soon
- tests
- examples
- code coverage

*The build is highly inspired by [react-bootstrap][rb]*

[travis.img]: https://travis-ci.org/dozoisch/react-google-recaptcha.svg?branch=master
[travis.url]: https://travis-ci.org/dozoisch/react-google-recaptcha
[npm.img]: https://badge.fury.io/js/react-google-recaptcha.svg
Expand Down

0 comments on commit dfa9bf2

Please sign in to comment.