evenchange4 / react-grecaptcha

React.js Google reCAPTCHA v2 integration component.
https://react-grecaptcha.netlify.com
MIT License
51 stars 8 forks source link

Invalid Props on div element #34

Closed fde31 closed 7 years ago

fde31 commented 7 years ago

When using the component React fires an

Unknown propscallback,expiredCallback,localeon <div> tag. Remove these props from the element.

Warning. This is due to the way that the component props are passed down to the actual div element without stripping the purely functional component props.

evenchange4 commented 7 years ago

Thanks for reporting this warning. We could simply omit those two props something like:

const { className, sitekey, callback, expiredCallback, ...otherProps } = this.props;

So that Unknown props will not automatically be passed down to the div through ...otherProps.

I may release a new version with this change tomorrow when I am able to access to internet on my computer. :)

fde31 commented 7 years ago

Just saw your comment. I have done it using lodash's omit in order to cover potential other props in the future gracefully without changing the code. Will file a pull request in a bit.