Skip to content

Commit b8660de

Browse files
committed
Make the onChange prop not required
The component works fine when no onChange handler is provided, because it creates an input component with the current value which is submitted with forms.
1 parent 1ff4eae commit b8660de

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/recaptcha.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default class ReCAPTCHA extends React.Component {
118118
ReCAPTCHA.displayName = "ReCAPTCHA";
119119
ReCAPTCHA.propTypes = {
120120
sitekey: PropTypes.string.isRequired,
121-
onChange: PropTypes.func.isRequired,
121+
onChange: PropTypes.func,
122122
grecaptcha: PropTypes.object,
123123
theme: PropTypes.oneOf(["dark", "light"]),
124124
type: PropTypes.oneOf(["image", "audio"]),
@@ -130,6 +130,7 @@ ReCAPTCHA.propTypes = {
130130
badge: PropTypes.oneOf(["bottomright", "bottomleft", "inline"]),
131131
};
132132
ReCAPTCHA.defaultProps = {
133+
onChange: () => {},
133134
theme: "light",
134135
type: "image",
135136
tabindex: 0,

0 commit comments

Comments
 (0)