This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect } from 'react'; | |
/** | |
* A hook to listen for width changes or scroll-bar show/hide. | |
* | |
* Arguments: | |
* * containerRef - a React ref to the element whose width you want to measure. | |
* * onWidthChanged - a function that is invoked when the width changes. | |
* | |
* Based on https://gist.github.com/AdamMcCormick/d5f718d2e9569acdf7def25e8266bb2a |