title: Comparing PrevProps in componentDidUpdate
body: <p>I am trying to detect when a prop has changed inside <code>componentDidUpdate</code> of a mounted component. I have a test (<code>refreshData</code> in the code below) that is working fine. Is it possible to SOMEHOW pass props in a way that aren't detected by <code>componentDidUpdate(prevProps)</code>?</p>
  <p>In component.js:</p>
  <pre><code>componentDidUpdate(prevProps){
  
      //works fine
      if ( this.props.refreshData !== prevProps.refreshData ) {
          if ( this.props.refreshData )
              this.refreshData();
      }
  
      //these two arent calling
      if ( this.props.selectedCountries !== prevProps.selectedCountries ) {
          if ( this.props.selectedCountries )
              console.log('updated selected countries');
      }
  
      if ( this.props.selectedLocations !== prevProps.selectedLocations ) {
          console.log('updated selected locations');
      }
  
  }
  </code></pre>
  <p>and in App.js passing the props like:</p>
  <pre><code>selectLocation = (id, type, lng, lat, polydata, name, clear = false) =&gt; {
  
    //console.log(type);
    //console.log(lng);
    //console.log(lat);
    //console.log(polydata);
  
    let selectedType = 'selected' + type;
    let previousState = [];
  
    if (clear) {
      this.setState({
        selectedCountries: [],
        selectedLocations: [],
        selectedServices: [],
        selectedPoints: [],
        mapCenter: [lng, lat],
        locationGeoCoords: [polydata]
      })
      previousState.push(id);
  
    } else {
  
      previousState = this.state[selectedType];
      if (previousState.indexOf(id) === -1) {
        //push id
        previousState.push(id);
  
      } else {
        //remove id
        var index = previousState.indexOf(id)
        previousState.splice(index, 1);
      }
    }
  
    if (type === &quot;Countries&quot;) {
  
      this.setState({
        selectedCountries: previousState,
        refreshData: true,
      })
    } else if (type === &quot;Locations&quot;) {
      this.setState({
        selectedLocations: previousState,
        refreshData: true
      })
    } else if (type === &quot;Points&quot;) {
      this.setState({
        selectedPoints: previousState,
        refreshData: true
      })
    }
  
  
  }
  
  
  render() {
    return (
  
      &lt;component
        selectedCountries={this.state.selectedCountries}
        selectedLocations={this.state.selectedLocations}
        refreshData={this.state.refreshData} /&gt;
    }
  }
  </code></pre>