-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
Happy to send a PR :)
From react/flow docs:
Note: To get the element instance, like HTMLButtonElement in the example above, it is a common mistake to use event.target instead of event.currentTarget. The reason why you want to use event.currentTarget is that event.target may be the wrong element due to event propagation.
handleChange = (e) => {
const { props } = this;
if (props.disabled) {
return;
}
if (!('checked' in props)) {
this.setState({
checked: e.target.checked,
});
}
props.onChange({
+ currentTarget: e.currentTarget,
target: {
...props,
checked: e.target.checked,
},
stopPropagation() {
e.stopPropagation();
},
preventDefault() {
e.preventDefault();
},
nativeEvent: e.nativeEvent,
});
};Metadata
Metadata
Assignees
Labels
No labels