fix lint error - getDerivedStateFromProps should be placed after state (#3391)

This commit is contained in:
Omer Lachish 2019-02-03 11:13:04 +02:00 committed by Arik Fraimovich
parent 807e6aaaa6
commit b0a11983fa

View File

@ -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;
@ -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);