Skip to content

Commit

Permalink
fix(switch): don't call onClick function unless exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jaketrent committed Feb 26, 2019
1 parent f27b503 commit 44b1b44
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/switch/src/react/index.js
Expand Up @@ -56,7 +56,8 @@ class Switch extends React.Component {
}

handleClick() {
this.props.onClick(!this.props.checked)
if (typeof this.props.onClick === 'function')
this.props.onClick(!this.props.checked)
}

handleFocus() {
Expand Down

0 comments on commit 44b1b44

Please sign in to comment.