Skip to content

Commit

Permalink
fix lint error - getDerivedStateFromProps should be placed after state (
Browse files Browse the repository at this point in the history
  • Loading branch information
Omer Lachish authored and arikfr committed Feb 3, 2019
1 parent 807e6aa commit b0a1198
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions client/app/components/TimeAgo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export class TimeAgo extends React.PureComponent {
autoUpdate: true,
};

// Initial state, to get rid of React warning
state = {
title: null,
value: null,
};

static getDerivedStateFromProps({ date, placeholder }) {
// if `date` prop is not empty and a valid date/time - convert it to `moment`
date = !isNil(date) ? moment(date) : null;
Expand All @@ -46,12 +52,6 @@ export class TimeAgo extends React.PureComponent {
};
}

// Initial state, to get rid of React warning
state = {
title: null,
value: null,
};

componentDidMount() {
autoUpdateList.add(this);
this.update(true);
Expand Down

0 comments on commit b0a1198

Please sign in to comment.