ReCaptcha component for GatsbyJS.
This plugin has been developed using GatsbyJS tutorials.
npm install @pittica/gatsby-plugin-recaptcha
Import the component classes.
import ReCaptcha from "@pittica/gatsby-plugin-recaptcha"
Use the component in React functions.
import React, { useState } from "react"
export default function ContactPage() {
const [submitted, setSubmitted] = useState(false)
const submit = (token) => {}
return (
<div>
<ReCaptcha
action="homepage"
siteKey="RECAPTCHA_PUBLIC_KEY"
onVerify={(token) => submit(token)}
submitted={submitted}
/>
<button onClick={() => setSubmitted(true)}>Submit</button>
</div>
)
}
The components has some attributes.
ReCaptcha public key.
ReCaptcha action. Common values are homepage or login.
HTML ID for multiple ReCaptcha elements.
Badge position and aspect.
Badge size.
Validation callback.
(c) 2020-2021, Pittica S.r.l..