Trying to access array offset on value of type null code example

Example 1: trying to access array offset on value of type bool

Easy with PHP ?? null coalescing operator

return $Row['Data'] ?? 'default value';
Or you can use as such

$Row['Data'] ??= 'default value';
return $Row['Data'];

Example 2: reactjs typeError: Cannot read property 'offsetHeight' of null

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

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

Tags:

Misc Example