reactjs - reCAPTCHA: Do not access .getDOMNode() -
i've been trying implement recaptcha react app when seemed ok checked console , found warning:
warning: reactdomcomponent: not access .getdomnode() of dom node; instead, use node directly. dom node rendered 'recaptcha'.
my current versions of packages:
`"react": "^0.14.7", "react-dom": "^0.14.7", "react-google-recaptcha": "^0.4.1",`
tried fix downgrading react@0.14.0
didn't help.
edit:
code:
onchange(response) { console.log("captcha value:", value); this.setstate({ 'g-recaptcha-response': response }); } render() { return ( <recaptcha ref="recaptcha" sitekey="6le0bcouaaaaamnfiwvy2b8w0z932ki6iu_zu3p9" onchange={this.onchange.bind(this)} /> ); }
and server side:
const recaptcha = require('express-recaptcha'); recaptcha.init(process.env.captcha_site_key, process.env.captcha_secret); module.exports = { captchaverify(req, res, next) { recaptcha.verify(req, (err) => { if (!err) { res.status(200).send({ err: 'approved' }); } else { res.status(422).send({ err: 'disapproved' }) } }) } }
you using outdated version of react-google-recaptcha
, leads an error/warning react 14. try upgrading with:
npm install --save react-google-recaptcha@0.9.6
if doesn't work, change version 0.5.1
, it's release introduced support react 14.
Comments
Post a Comment