From 3d1f2397573c121afb97a885e1695d1f84b2c0c6 Mon Sep 17 00:00:00 2001 From: Corey Collins Date: Fri, 5 Oct 2018 11:08:46 -0500 Subject: [PATCH] Replaces componentWillReceiveProps with getDerivedStateFromProps in dropdown component --- src/components/multiselect/dropdown.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/multiselect/dropdown.js b/src/components/multiselect/dropdown.js index 272a1684..d564b762 100644 --- a/src/components/multiselect/dropdown.js +++ b/src/components/multiselect/dropdown.js @@ -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() {