2.1.0 • Published 3 years ago
react_helmet_recaptcha_v3 v2.1.0
Set 'RECAPTCHA_SITE' environment variable with your ReCaptcha Site Key (not your secret key)
Import { LoadReCaptcha } to include the ReCaptcha script on any pages where you need to run ReCaptcha.
Place <LoadReCaptcha />
on the page.
Import { runReCaptcha } to programmatically-invoke ReCaptcha on an action, e.g. after a user submits a form.
Use like: runReCaptcha('action').then((token) => // Send token to your backend to verify ).catch((reason) => // Handle ReCaptcha errors)
Import { RunReCaptchaOnComponentLoad } to execute ReCaptcha automatically just when the component loads.
E.g. place this component on your homepage: <RunReCaptchaOnComponentLoad action='homepage'>
to execute ReCaptcha when a user loads your homepage.