Skip to content

Commit e77b270

Browse files
author
Samin Adhikari
committed
componentWillReceiveProps used to pass test
1 parent d7ef5f6 commit e77b270

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

datepicker.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,10 @@ class DatePicker extends Component {
5050
this.setModalVisible = this.setModalVisible.bind(this);
5151
}
5252

53-
static getDerivedStateFromProps(nextProps, prevState) {
54-
if (nextProps.date !== prevState.date) {
55-
return ({date: nextProps.date});
53+
componentWillReceiveProps(nextProps) {
54+
if (nextProps.date !== this.props.date) {
55+
this.setState({date: this.getDate(nextProps.date)});
5656
}
57-
return null;
5857
}
5958

6059
setModalVisible(visible) {

0 commit comments

Comments
 (0)