From e62c224cdda2038ee90042d1e3beb1284d1a2a15 Mon Sep 17 00:00:00 2001 From: Andrew Gauger Date: Wed, 26 Feb 2020 09:29:11 -0800 Subject: [PATCH] Remove componentWillReceiveProps in favor of checking componentDidUpdate props for changes --- src/timeInput.jsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/timeInput.jsx b/src/timeInput.jsx index d664e84..a5ad884 100644 --- a/src/timeInput.jsx +++ b/src/timeInput.jsx @@ -18,17 +18,14 @@ class TimeInput extends Component { } } - componentDidUpdate() { + componentDidUpdate(prev) { if (this.props.mountFocus) { setTimeout(() => { this._input.focus(); }, 0); } - } - - componentWillReceiveProps(nextProps) { - if (nextProps.initTime) { - this.onChangeHandler(nextProps.initTime); + if (this.props.initTime !== prev.initTime) { + this.onChangeHandler(this.props.initTime) } }