Skip to content

Commit

Permalink
Optimize onChange function not to process value if no onChange is def…
Browse files Browse the repository at this point in the history
…ined
  • Loading branch information
wojtekmaj committed Sep 9, 2017
1 parent d272224 commit d974e6f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ export default class Calendar extends Component {
this.setState({ value });

const { onChange } = this.props;
const processedValue = this.getProcessedValue(value);
if (onChange) onChange(processedValue);
if (onChange) {
const processedValue = this.getProcessedValue(value);
onChange(processedValue);
}
}

renderContent() {
Expand Down

0 comments on commit d974e6f

Please sign in to comment.