title: Javascript - React - return multiple values
body: <p>In my React component I have the following method to keep the state and props in sync: </p>
  
  <pre><code>    static getDerivedStateFromProps(nextProps, prevState) {
          return nextProps.filterName === prevState.filterName ? '' : { filterName: nextProps.filterName };
      }
  </code></pre>
  
  <p>This is valid and working, but I want to also add a second line in the same method to update another state property:</p>
  
  <pre><code>   return nextProps.saveChecked === prevState.saveChecked ? false : { saveChecked: nextProps.saveChecked };
  </code></pre>
  
  <p>If I replace the existing return statement for filterName with this one for saveChecked, it works. I get an error when adding both "return" statements that it is invalid. Is there a valid way to rewrite this so both state properties can be updated?</p>