Skip to content

Commit

Permalink
Only reset state when this.props.value has changed
Browse files Browse the repository at this point in the history
  • Loading branch information
acusti committed Oct 15, 2021
1 parent 1b17682 commit 1b0b5ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ReactCodeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ReactCodeInput extends Component {
}

UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.value == null) {
if (nextProps.value == null || nextProps.value === this.props.value) {
return;
}
this.setState({
Expand Down

0 comments on commit 1b0b5ab

Please sign in to comment.