Skip to content

Commit

Permalink
Replaces componentWillReceiveProps with getDerivedStateFromProps in d…
Browse files Browse the repository at this point in the history
…ropdown component
  • Loading branch information
coreymcollins committed Oct 5, 2018
1 parent 78013af commit 3d1f239
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/multiselect/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ class DropDown extends Component {
};
}

componentWillReceiveProps( nextProps ) {
static getDerivedStateFromProps( nextProps, prevState ) {

if ( nextProps.selectedItems !== undefined ) {
this.setState( { selectedItems: nextProps.selectedItems } );
return {
selectedItems: nextProps.selectedItems
};
}

return null;
}

render() {
Expand Down

0 comments on commit 3d1f239

Please sign in to comment.