On React 16, let's say I have a component like
class Profile extends React.Component {
onClick = () => {
throw new Error("Oh nooo!");
});
};
componentDidCatch(error, info) {
alert(error)
}
render() {
return (
<div onClick={this.onClick}>
Name: {this.props.user.name}
</div>
);
}
}
and then in the constructor I do this.onClick = this.onClick.bind(this)
. Will the error be catched in componentDidCatch()
?