reactjs typeError: Cannot read property 'offsetHeight' of null

JavaScript
  handleResize = () => {
    let highestSlide = 0;

    this.refArray.forEach(ref => {
      if (ref.current && highestSlide < ref.current.offsetHeight) {
        highestSlide = ref.current.offsetHeight;
      }
    });
  };
Source

Also in JavaScript: