From 66d7a8d16a4c10e6ef4ba61f8091c1fc9543be92 Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Thu, 14 Oct 2021 17:23:59 -0700 Subject: [PATCH] Update state.value + state.input on props change #69 #129 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit makes it possible to reset ReactCodeInput’s internal state and the values it renders in its inputs by passing in an updated this.props.value --- src/ReactCodeInput.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ReactCodeInput.js b/src/ReactCodeInput.js index a88fd5a..6fe5fa9 100644 --- a/src/ReactCodeInput.js +++ b/src/ReactCodeInput.js @@ -48,7 +48,8 @@ class ReactCodeInput extends Component { } this.setState({ - value: nextProps.value, + input: getInputArrayFromProps(nextProps), + value: getValueFromProps(nextProps), }); }