5
5
[ ![ Dependencies] [ deps.img ]] [ deps.url ]
6
6
[ ![ Dev Dependencies] [ devdeps.img ]] [ devdeps.url ]
7
7
8
- Component wrapper for [ Google reCAPTCHA] [ reCAPTCHA ]
8
+ Component wrapper for [ Google reCAPTCHA v2 ] [ reCAPTCHA ]
9
9
10
10
## Installation
11
11
12
12
``` shell
13
13
npm install --save react-google-recaptcha
14
14
```
15
15
16
+ ### React 0.13
17
+ With 0.13, install version 0.4.0
18
+ ``` shell
19
+ npm install --save react-google-recaptcha@0.4.0
20
+ ```
21
+
16
22
## Usage
17
23
18
24
All you need to do is [ sign up for an API key pair] [ signup ] . You will need the client key.
@@ -21,18 +27,21 @@ You can then use the reCAPTCHA. The default require, imports a wrapped component
21
27
22
28
``` jsx
23
29
var React = require (" react" );
30
+ var render = require (" react-dom" ).render
24
31
var ReCAPTCHA = require (" react-google-recaptcha" );
25
32
26
33
function onChange (value ) {
27
34
console .log (" Captcha value:" , value);
28
35
}
29
36
30
- React .render (
31
- < ReCAPTCHA
32
- ref= " recaptcha"
33
- sitekey= " Your client site key"
34
- onChange= {onChange}
35
- / > , document .body );
37
+ render (
38
+ < ReCAPTCHA
39
+ ref= " recaptcha"
40
+ sitekey= " Your client site key"
41
+ onChange= {onChange}
42
+ / > ,
43
+ document .body
44
+ );
36
45
```
37
46
38
47
### Rendering Props
@@ -61,6 +70,7 @@ You can also use the barebone components doing the following. Using that compone
61
70
62
71
``` jsx
63
72
var React = require (" react" );
73
+ var render = require (" react-dom" ).render
64
74
var ReCAPTCHA = require (" react-google-recaptcha/lib/recaptcha" );
65
75
66
76
var grecaptchaObject = grecaptcha // You must provide access to the google grecaptcha object.
@@ -69,24 +79,17 @@ function onChange(value) {
69
79
console .log (" Captcha value:" , value);
70
80
}
71
81
72
- React .render (
73
- < ReCAPTCHA
74
- ref= " recaptcha"
75
- sitekey= " Your client site key"
76
- onChange= {onChange}
77
- grecaptcha= {grecaptchaObject}
78
- / > , document .body );
82
+ render (
83
+ < ReCAPTCHA
84
+ ref= " recaptcha"
85
+ sitekey= " Your client site key"
86
+ onChange= {onChange}
87
+ grecaptcha= {grecaptchaObject}
88
+ / > ,
89
+ document .body
90
+ );
79
91
```
80
92
81
-
82
-
83
- ## To Come Soon
84
- - tests
85
- - examples
86
- - code coverage
87
-
88
- * The build is highly inspired by [ react-bootstrap] [ rb ] *
89
-
90
93
[ travis.img ] : https://travis-ci.org/dozoisch/react-google-recaptcha.svg?branch=master
91
94
[ travis.url ] : https://travis-ci.org/dozoisch/react-google-recaptcha
92
95
[ npm.img ] : https://badge.fury.io/js/react-google-recaptcha.svg
0 commit comments