Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #369 from FormidableLabs/improvement/add-events-in…
Browse files Browse the repository at this point in the history
…itial-state

use constructor instead of componentWillMount
  • Loading branch information
boygirl authored Apr 21, 2018
2 parents 78cbc10 + 8a589a3 commit eaf7c14
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/victory-util/add-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ const defaultComponents = [
export default (WrappedComponent, options) => {
return class addEvents extends WrappedComponent {

componentWillMount() {
if (isFunction(super.componentWillMount)) {
super.componentWillMount();
}
constructor(props) {
super(props);
const getScopedEvents = Events.getScopedEvents.bind(this);
const boundGetEvents = Events.getEvents.bind(this);
this.getEvents = (props, target, eventKey) => {
return boundGetEvents(props, target, eventKey, getScopedEvents);
this.state = {};
this.getEvents = (p, target, eventKey) => {
return boundGetEvents(p, target, eventKey, getScopedEvents);
};
this.getEventState = Events.getEventState.bind(this);
const calculatedValues = this.getCalculatedValues(this.props);
Expand Down

0 comments on commit eaf7c14

Please sign in to comment.