code: function updater(prevState) {
      var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
      return state !== null && state !== undefined ? state : null;
    }
docs: Call this.constructor.gDSFP to support sub-classes. Use the setState() updater to ensure state isn't stale in certain edge cases.